Saravanan Vajravel
eca5cd9474
RDMA/srpt: Add a check for valid 'mad_agent' pointer
When unregistering MAD agent, srpt module has a non-null check
for 'mad_agent' pointer before invoking ib_unregister_mad_agent().
This check can pass if 'mad_agent' variable holds an error value.
The 'mad_agent' can have an error value for a short window when
srpt_add_one() and srpt_remove_one() is executed simultaneously.
In srpt module, added a valid pointer check for 'sport->mad_agent'
before unregistering MAD agent.
This issue can hit when RoCE driver unregisters ib_device
Stack Trace:
------------
BUG: kernel NULL pointer dereference, address: 000000000000004d
PGD 145003067 P4D 145003067 PUD 2324fe067 PMD 0
Oops: 0002 [#1] PREEMPT SMP NOPTI
CPU: 10 PID: 4459 Comm: kworker/u80:0 Kdump: loaded Tainted: P
Hardware name: Dell Inc. PowerEdge R640/06NR82, BIOS 2.5.4 01/13/2020
Workqueue: bnxt_re bnxt_re_task [bnxt_re]
RIP: 0010:_raw_spin_lock_irqsave+0x19/0x40
Call Trace:
ib_unregister_mad_agent+0x46/0x2f0 [ib_core]
IPv6: ADDRCONF(NETDEV_CHANGE): bond0: link becomes ready
? __schedule+0x20b/0x560
srpt_unregister_mad_agent+0x93/0xd0 [ib_srpt]
srpt_remove_one+0x20/0x150 [ib_srpt]
remove_client_context+0x88/0xd0 [ib_core]
bond0: (slave p2p1): link status definitely up, 100000 Mbps full duplex
disable_device+0x8a/0x160 [ib_core]
bond0: active interface up!
? kernfs_name_hash+0x12/0x80
(NULL device *): Bonding Info Received: rdev: 000000006c0b8247
__ib_unregister_device+0x42/0xb0 [ib_core]
(NULL device *): Master: mode: 4 num_slaves:2
ib_unregister_device+0x22/0x30 [ib_core]
(NULL device *): Slave: id: 105069936 name:p2p1 link:0 state:0
bnxt_re_stopqps_and_ib_uninit+0x83/0x90 [bnxt_re]
bnxt_re_alloc_lag+0x12e/0x4e0 [bnxt_re]
Fixes: a42d985bd5 ("ib_srpt: Initial SRP Target merge for v3.3-rc1")
Reviewed-by: Selvin Xavier <selvin.xavier@broadcom.com>
Reviewed-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Saravanan Vajravel <saravanan.vajravel@broadcom.com>
Link: https://lore.kernel.org/r/20230406042549.507328-1-saravanan.vajravel@broadcom.com
Reviewed-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
2023-04-09 13:04:26 +03:00
..
2023-03-13 12:44:53 +01:00
2023-03-17 16:44:41 +01:00
2023-02-24 12:47:33 -08:00
2023-03-16 16:54:38 +09:00
2023-03-05 11:19:16 -08:00
2023-03-15 08:48:58 -06:00
2023-02-09 14:20:04 -08:00
2023-02-27 10:04:49 -08:00
2023-03-12 23:28:10 +02:00
2023-03-06 14:41:20 -08:00
2023-02-21 09:45:13 -08:00
2023-03-03 10:30:58 -08:00
2023-03-07 14:04:13 +01:00
2023-03-05 11:32:30 -08:00
2023-02-25 09:19:23 -08:00
2023-02-25 09:19:23 -08:00
2023-02-24 17:18:54 -08:00
2023-02-17 09:16:34 +01:00
2023-02-21 08:10:03 -08:00
2023-02-04 13:05:42 +00:00
2023-02-24 12:58:55 -08:00
2023-03-09 18:00:31 +01:00
2023-02-24 12:58:55 -08:00
2023-03-07 14:15:10 +01:00
2023-03-17 16:06:58 +10:00
2023-03-09 10:17:23 -08:00
2023-02-24 12:58:55 -08:00
2023-02-24 12:58:55 -08:00
2023-03-15 19:15:00 -07:00
2023-02-24 12:58:55 -08:00
2023-03-09 22:07:52 +01:00
2023-02-28 16:05:01 -08:00
2023-02-21 12:13:58 -08:00
2023-02-24 12:47:33 -08:00
2023-04-09 13:04:26 +03:00
2023-02-27 10:04:49 -08:00
2023-03-13 21:13:48 +02:00
2023-02-27 10:04:49 -08:00
2023-02-24 12:58:55 -08:00
2023-02-25 11:30:21 -08:00
2023-02-23 15:09:31 -08:00
2023-02-25 11:00:06 -08:00
2023-02-23 14:47:13 -06:00
2023-03-15 12:18:07 -06:00
2023-03-18 11:07:15 -07:00
2023-03-13 21:13:49 +02:00
2023-02-27 09:47:26 -08:00
2023-02-27 14:05:08 -08:00
2023-03-09 21:58:45 +01:00
2023-03-09 15:33:51 +01:00
2023-03-11 09:24:05 -08:00
2023-04-04 09:17:21 +03:00
2023-03-15 00:28:23 -07:00
2023-02-25 11:48:02 -08:00
2023-03-16 07:01:48 -06:00
2023-03-10 10:55:49 +01:00
2023-02-24 13:40:13 -08:00
2023-02-16 13:48:53 +01:00
2023-02-24 12:47:33 -08:00
2023-03-13 09:15:11 +01:00
2023-02-24 12:58:55 -08:00
2023-03-03 09:32:51 -08:00
2023-02-27 10:04:49 -08:00
2023-02-27 10:04:49 -08:00
2023-03-07 12:08:30 +01:00
2023-03-03 16:33:28 -08:00
2023-03-03 10:30:58 -08:00
2023-02-22 21:23:48 -08:00
2023-02-20 12:26:35 +01:00
2023-03-02 09:21:25 -08:00
2023-02-27 10:04:49 -08:00
2023-02-26 12:10:28 -08:00
2023-03-03 09:15:50 -08:00
2023-03-03 14:41:50 -08:00
2023-02-09 16:51:39 -08:00
2023-03-17 09:30:57 -07:00
2023-03-01 09:44:22 -08:00
2023-02-27 10:04:49 -08:00
2023-02-24 17:29:52 -08:00
2023-03-02 09:25:38 -08:00
2023-03-09 10:06:28 +01:00
2023-03-06 16:50:42 -05:00
2023-02-24 12:58:55 -08:00
2023-03-03 20:34:49 +01:00
2023-02-24 12:58:55 -08:00
2023-03-19 10:09:58 -07:00
2023-03-09 21:09:28 -05:00
2023-02-23 17:09:35 -08:00
2023-02-24 17:22:11 -08:00
2023-03-13 02:29:12 -04:00
2023-02-25 11:52:57 -08:00
2023-03-13 02:29:11 -04:00
2023-03-18 16:01:34 -07:00
2023-03-13 13:29:27 +01:00
2023-02-25 11:48:02 -08:00
2023-03-09 21:58:57 +01:00
2023-03-02 11:12:01 -08:00
2023-03-17 10:45:49 -07:00
2023-02-26 11:53:25 -08:00