linux-stable/drivers/infiniband/core
Alex Estrin 7f6a5410f5 IB/core: Fix for core panic
commit e6f9bc34d3 upstream.

Build with the latest patches resulted in panic:
11384.486289] BUG: unable to handle kernel NULL pointer dereference at
         (null)
[11384.486293] IP:           (null)
[11384.486295] PGD 0
[11384.486295] P4D 0
[11384.486296]
[11384.486299] Oops: 0010 [#1] SMP
......... snip ......
[11384.486401] CPU: 0 PID: 968 Comm: kworker/0:1H Tainted: G        W  O
    4.13.0-a-stream-20170825 #1
[11384.486402] Hardware name: Intel Corporation S2600WT2R/S2600WT2R,
BIOS SE5C610.86B.01.01.0014.121820151719 12/18/2015
[11384.486418] Workqueue: ib-comp-wq ib_cq_poll_work [ib_core]
[11384.486419] task: ffff880850579680 task.stack: ffffc90007fec000
[11384.486420] RIP: 0010:          (null)
[11384.486420] RSP: 0018:ffffc90007fef970 EFLAGS: 00010206
[11384.486421] RAX: ffff88084cfe8000 RBX: ffff88084dce4000 RCX:
ffffc90007fef978
[11384.486422] RDX: 0000000000000000 RSI: 0000000000000001 RDI:
ffff88084cfe8000
[11384.486422] RBP: ffffc90007fefab0 R08: 0000000000000000 R09:
ffff88084dce4080
[11384.486423] R10: ffffffffa02d7f60 R11: 0000000000000000 R12:
ffff88105af65a00
[11384.486423] R13: ffff88084dce4000 R14: 000000000000c000 R15:
000000000000c000
[11384.486424] FS:  0000000000000000(0000) GS:ffff88085f400000(0000)
knlGS:0000000000000000
[11384.486425] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[11384.486425] CR2: 0000000000000000 CR3: 0000000001c09000 CR4:
00000000001406f0
[11384.486426] Call Trace:
[11384.486431]  ? is_valid_mcast_lid.isra.21+0xfb/0x110 [ib_core]
[11384.486436]  ib_attach_mcast+0x6f/0xa0 [ib_core]
[11384.486441]  ipoib_mcast_attach+0x81/0x190 [ib_ipoib]
[11384.486443]  ipoib_mcast_join_complete+0x354/0xb40 [ib_ipoib]
[11384.486448]  mcast_work_handler+0x330/0x6c0 [ib_core]
[11384.486452]  join_handler+0x101/0x220 [ib_core]
[11384.486455]  ib_sa_mcmember_rec_callback+0x54/0x80 [ib_core]
[11384.486459]  recv_handler+0x3a/0x60 [ib_core]
[11384.486462]  ib_mad_recv_done+0x423/0x9b0 [ib_core]
[11384.486466]  __ib_process_cq+0x5d/0xb0 [ib_core]
[11384.486469]  ib_cq_poll_work+0x20/0x60 [ib_core]
[11384.486472]  process_one_work+0x149/0x360
[11384.486474]  worker_thread+0x4d/0x3c0
[11384.486487]  kthread+0x109/0x140
[11384.486488]  ? rescuer_thread+0x380/0x380
[11384.486489]  ? kthread_park+0x60/0x60
[11384.486490]  ? kthread_park+0x60/0x60
[11384.486493]  ret_from_fork+0x25/0x30
[11384.486493] Code:  Bad RIP value.
[11384.486493] Code:  Bad RIP value.
[11384.486496] RIP:           (null) RSP: ffffc90007fef970
[11384.486497] CR2: 0000000000000000
[11384.486531] ---[ end trace b1acec6fb4ff6e75 ]---
[11384.532133] Kernel panic - not syncing: Fatal exception
[11384.536541] Kernel Offset: disabled
[11384.969491] ---[ end Kernel panic - not syncing: Fatal exception
[11384.976875] sched: Unexpected reschedule of offline CPU#1!
[11384.983646] ------------[ cut here ]------------

Rdma device driver may not have implemented (*get_link_layer)()
so it can not be called directly. Should use appropriate helper function.

Reviewed-by: Yuval Shaia <yuval.shaia@oracle.com>
Fixes: 5236333592 ("IB/core: Fix the validations of a multicast LID in attach or detach operations")
Cc: stable@kernel.org # 4.13
Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Signed-off-by: Alex Estrin <alex.estrin@intel.com>
Signed-off-by: Dennis Dalessandro <dennis.dalessandro@intel.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Cc: Mike Marciniszyn <mike.marciniszyn@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-12-01 09:44:20 +01:00
..
addr.c RDMA/ucma: Introduce safer rdma_addr_size() variants 2018-04-08 12:12:49 +02:00
agent.c
agent.h
cache.c IB/core: Fix error code for invalid GID entry 2018-06-06 16:44:38 +02:00
cm.c IB/cm: Mark stale CM id's whenever the mad agent was unregistered 2016-11-16 20:03:44 -05:00
cm_msgs.h
cma.c RDMA/cma: Protect cma dev list with lock 2018-09-26 08:36:34 +02:00
cma_configfs.c configfs: switch ->default groups to a linked list 2016-03-06 16:11:24 +01:00
core_priv.h IB/core: Add IP to GID netlink offload 2016-05-24 14:44:04 -04:00
cq.c IB/core: Protect against self-requeue of a cq work item 2017-12-25 14:23:41 +01:00
device.c IB/device: Convert ib-comp-wq to be CPU-bound 2018-05-16 10:08:40 +02:00
fmr_pool.c IB/core: trivial prink cleanup. 2016-03-03 10:20:25 -05:00
iwcm.c IB/iwcm: Remove deprecated create_singlethread_workqueue 2016-10-07 16:54:25 -04:00
iwcm.h iw_cm: free cm_id resources on the last deref 2016-08-02 13:15:18 -04:00
iwpm_msg.c RDMA/core: Fix indentation 2016-06-06 19:36:21 -04:00
iwpm_util.c RDMA/iwpm: Fix uninitialized error code in iwpm_send_mapinfo() 2018-03-24 11:00:23 +01:00
iwpm_util.h iwpm: crash fix for large connections test 2016-03-16 13:48:32 -04:00
mad.c RDMA/mad: Convert BUG_ONs to error flows 2018-08-03 07:55:14 +02:00
mad_priv.h
mad_rmpp.c
mad_rmpp.h
Makefile RDMA/ucm: Mark UCM interface as BROKEN 2018-07-17 11:37:54 +02:00
mr_pool.c IB/core: add a simple MR pool 2016-05-13 13:37:18 -04:00
multicast.c IB/core: Honor port_num while resolving GID for IB link layer 2018-05-30 07:50:45 +02:00
netlink.c IB/core: Add flow control to the portmapper netlink calls 2016-08-02 13:14:27 -04:00
opa_smi.h
packer.c IB/core: trivial prink cleanup. 2016-03-03 10:20:25 -05:00
roce_gid_mgmt.c
rw.c IB/core: type promotion bug in rdma_rw_init_one_mr() 2018-10-03 17:01:44 -07:00
sa.h
sa_query.c IB/core: Fix possible crash to access NULL netdev 2018-05-30 07:50:36 +02:00
smi.c
smi.h
sysfs.c RDMA/core: Do not expose unsupported counters 2018-11-13 11:16:52 -08:00
ucm.c IB/ucm: Fix Spectre v1 vulnerability 2018-11-10 07:43:00 -08:00
ucma.c RDMA/ucma: Fix Spectre v1 vulnerability 2018-11-10 07:43:00 -08:00
ud_header.c IB/core: trivial prink cleanup. 2016-03-03 10:20:25 -05:00
umem.c IB/core: Make testing MR flags for writability a static inline function 2018-08-15 18:14:43 +02:00
umem_odp.c mm: replace get_user_pages_remote() write/force parameters with gup_flags 2016-10-19 08:12:02 -07:00
umem_rbtree.c
user_mad.c
uverbs.h Merge branches 'misc' and 'rxe' into k.o/for-4.8-1 2016-08-04 11:13:47 -04:00
uverbs_cmd.c RDMA/uverbs: Protect from attempts to create flows on unsupported QP 2018-08-03 07:55:26 +02:00
uverbs_main.c RDMA/uverbs: Protect from command mask overflow 2018-02-28 10:18:31 +01:00
uverbs_marshall.c
verbs.c IB/core: Fix for core panic 2018-12-01 09:44:20 +01:00