linux/drivers/net/ethernet
Patrisious Haddad 664f76be38 net/mlx5: Fix IPsec cleanup over MPV device
When we do mlx5e_detach_netdev() we eventually disable blocking events
notifier, among those events are IPsec MPV events from IB to core.

So before disabling those blocking events, make sure to also unregister
the devcom device and mark all this device operations as complete,
in order to prevent the other device from using invalid netdev
during future devcom events which could cause the trace below.

BUG: kernel NULL pointer dereference, address: 0000000000000010
PGD 146427067 P4D 146427067 PUD 146488067 PMD 0
Oops: Oops: 0000 [#1] SMP
CPU: 1 UID: 0 PID: 7735 Comm: devlink Tainted: GW 6.12.0-rc6_for_upstream_min_debug_2024_11_08_00_46 #1
Tainted: [W]=WARN
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014
RIP: 0010:mlx5_devcom_comp_set_ready+0x5/0x40 [mlx5_core]
Code: 00 01 48 83 05 23 32 1e 00 01 41 b8 ed ff ff ff e9 60 ff ff ff 48 83 05 00 32 1e 00 01 eb e3 66 0f 1f 44 00 00 0f 1f 44 00 00 <48> 8b 47 10 48 83 05 5f 32 1e 00 01 48 8b 50 40 48 85 d2 74 05 40
RSP: 0018:ffff88811a5c35f8 EFLAGS: 00010206
RAX: ffff888106e8ab80 RBX: ffff888107d7e200 RCX: ffff88810d6f0a00
RDX: ffff88810d6f0a00 RSI: 0000000000000001 RDI: 0000000000000000
RBP: ffff88811a17e620 R08: 0000000000000040 R09: 0000000000000000
R10: ffff88811a5c3618 R11: 0000000de85d51bd R12: ffff88811a17e600
R13: ffff88810d6f0a00 R14: 0000000000000000 R15: ffff8881034bda80
FS:  00007f27bdf89180(0000) GS:ffff88852c880000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000010 CR3: 000000010f159005 CR4: 0000000000372eb0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 ? __die+0x20/0x60
 ? page_fault_oops+0x150/0x3e0
 ? exc_page_fault+0x74/0x130
 ? asm_exc_page_fault+0x22/0x30
 ? mlx5_devcom_comp_set_ready+0x5/0x40 [mlx5_core]
 mlx5e_devcom_event_mpv+0x42/0x60 [mlx5_core]
 mlx5_devcom_send_event+0x8c/0x170 [mlx5_core]
 blocking_event+0x17b/0x230 [mlx5_core]
 notifier_call_chain+0x35/0xa0
 blocking_notifier_call_chain+0x3d/0x60
 mlx5_blocking_notifier_call_chain+0x22/0x30 [mlx5_core]
 mlx5_core_mp_event_replay+0x12/0x20 [mlx5_core]
 mlx5_ib_bind_slave_port+0x228/0x2c0 [mlx5_ib]
 mlx5_ib_stage_init_init+0x664/0x9d0 [mlx5_ib]
 ? idr_alloc_cyclic+0x50/0xb0
 ? __kmalloc_cache_noprof+0x167/0x340
 ? __kmalloc_noprof+0x1a7/0x430
 __mlx5_ib_add+0x34/0xd0 [mlx5_ib]
 mlx5r_probe+0xe9/0x310 [mlx5_ib]
 ? kernfs_add_one+0x107/0x150
 ? __mlx5_ib_add+0xd0/0xd0 [mlx5_ib]
 auxiliary_bus_probe+0x3e/0x90
 really_probe+0xc5/0x3a0
 ? driver_probe_device+0x90/0x90
 __driver_probe_device+0x80/0x160
 driver_probe_device+0x1e/0x90
 __device_attach_driver+0x7d/0x100
 bus_for_each_drv+0x80/0xd0
 __device_attach+0xbc/0x1f0
 bus_probe_device+0x86/0xa0
 device_add+0x62d/0x830
 __auxiliary_device_add+0x3b/0xa0
 ? auxiliary_device_init+0x41/0x90
 add_adev+0xd1/0x150 [mlx5_core]
 mlx5_rescan_drivers_locked+0x21c/0x300 [mlx5_core]
 esw_mode_change+0x6c/0xc0 [mlx5_core]
 mlx5_devlink_eswitch_mode_set+0x21e/0x640 [mlx5_core]
 devlink_nl_eswitch_set_doit+0x60/0xe0
 genl_family_rcv_msg_doit+0xd0/0x120
 genl_rcv_msg+0x180/0x2b0
 ? devlink_get_from_attrs_lock+0x170/0x170
 ? devlink_nl_eswitch_get_doit+0x290/0x290
 ? devlink_nl_pre_doit_port_optional+0x50/0x50
 ? genl_family_rcv_msg_dumpit+0xf0/0xf0
 netlink_rcv_skb+0x54/0x100
 genl_rcv+0x24/0x40
 netlink_unicast+0x1fc/0x2d0
 netlink_sendmsg+0x1e4/0x410
 __sock_sendmsg+0x38/0x60
 ? sockfd_lookup_light+0x12/0x60
 __sys_sendto+0x105/0x160
 ? __sys_recvmsg+0x4e/0x90
 __x64_sys_sendto+0x20/0x30
 do_syscall_64+0x4c/0x100
 entry_SYSCALL_64_after_hwframe+0x4b/0x53
RIP: 0033:0x7f27bc91b13a
Code: bb 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 8b 05 fa 96 2c 00 45 89 c9 4c 63 d1 48 63 ff 85 c0 75 15 b8 2c 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 76 f3 c3 0f 1f 40 00 41 55 41 54 4d 89 c5 55
RSP: 002b:00007fff369557e8 EFLAGS: 00000246 ORIG_RAX: 000000000000002c
RAX: ffffffffffffffda RBX: 0000000009c54b10 RCX: 00007f27bc91b13a
RDX: 0000000000000038 RSI: 0000000009c54b10 RDI: 0000000000000006
RBP: 0000000009c54920 R08: 00007f27bd0030e0 R09: 000000000000000c
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001
 </TASK>
Modules linked in: mlx5_vdpa vringh vhost_iotlb vdpa xt_MASQUERADE nf_conntrack_netlink nfnetlink iptable_nat xt_addrtype xt_conntrack nf_nat br_netfilter rpcsec_gss_krb5 auth_rpcgss oid_registry overlay rpcrdma rdma_ucm ib_iser libiscsi ib_umad scsi_transport_iscsi ib_ipoib rdma_cm iw_cm ib_cm mlx5_fwctl mlx5_ib ib_uverbs ib_core mlx5_core
CR2: 0000000000000010

Fixes: 82f9378c44 ("net/mlx5: Handle IPsec steering upon master unbind/bind")
Signed-off-by: Patrisious Haddad <phaddad@nvidia.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://patch.msgid.link/1761136182-918470-5-git-send-email-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2025-10-23 07:14:33 -07:00
..
3com treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
8390 treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
actions
adaptec
adi
aeroflex
agere et131x: Add missing check after DMA map 2025-07-17 19:02:55 -07:00
airoha net: airoha: Take into account out-of-order tx completions in airoha_dev_xmit() 2025-10-14 12:33:46 +02:00
alacritech
allwinner
alteon
altera
amazon net: ena: return 0 in ena_get_rxfh_key_size() when RSS hash key is not configurable 2025-09-29 18:33:53 -07:00
amd amd-xgbe: Avoid spurious link down messages during interface toggle 2025-10-14 10:30:34 +02:00
apm
apple treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
aquantia net: atlantic: Rename PCI driver struct to end in _driver 2025-07-01 19:35:58 -07:00
arc
asix
atheros net: Use netif_threaded_enable instead of netif_set_threaded in drivers 2025-07-24 18:34:55 -07:00
broadcom tg3: prevent use of uninitialized remote_adv and local_adv variables 2025-10-15 17:16:49 -07:00
brocade treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
cadence Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-10-01 10:14:49 +02:00
calxeda
cavium net: WQ_PERCPU added to alloc_workqueue users 2025-09-22 17:40:30 -07:00
chelsio tcp: Remove sk->sk_prot->orphan_count. 2025-09-01 12:52:09 -07:00
cirrus
cisco Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-07-04 08:03:18 +02:00
cortina
davicom
dec net: Fix typos 2025-07-25 10:29:07 -07:00
dlink net: dlink: use dev_kfree_skb_any instead of dev_kfree_skb 2025-10-21 18:38:38 -07:00
emulex benet: fix BUG when creating VFs 2025-08-04 17:17:31 -07:00
engleder
ezchip
faraday net: ftgmac100: fix potential NULL pointer access in ftgmac100_phy_disconnect 2025-08-05 16:00:53 -07:00
freescale dpaa2-eth: fix the pointer passed to PTR_ALIGN on Tx path 2025-10-17 16:31:40 -07:00
fujitsu
fungible ethtool: add FEC bins histogram report 2025-09-26 16:49:18 -07:00
google gve: Check valid ts bit on RX descriptor before hw timestamping 2025-10-15 09:04:58 -07:00
hisilicon net: hibmcge: select FIXED_PHY 2025-10-21 18:42:20 -07:00
huawei hinic3: Fix NULL vs IS_ERR() check in hinic3_alloc_rxqs_res() 2025-09-19 07:05:51 -07:00
i825xx
ibm ibmvnic: Increase max subcrq indirect entries with fallback 2025-08-26 09:45:50 +02:00
intel ixgbe: fix too early devlink_free() in ixgbe_remove() 2025-10-13 17:44:49 -07:00
litex
marvell Octeontx2-af: Fix missing error code in cgx_probe() 2025-10-14 11:47:31 +02:00
mediatek net: mtk: wed: add dma mask limitation and GFP_DMA32 for device with more than 4GB DRAM 2025-10-12 18:14:55 +01:00
mellanox net/mlx5: Fix IPsec cleanup over MPV device 2025-10-23 07:14:33 -07:00
meta eth: fbnic: fix reporting of alloc_failed qstats 2025-10-09 11:10:02 +02:00
micrel net: Fix typos 2025-07-25 10:29:07 -07:00
microchip net: sparx5/lan969x: fix flooding configuration on bridge join/leave 2025-10-07 11:53:45 +02:00
microsoft net: mana: Reduce waiting time if HWC not responding 2025-09-14 11:54:07 -07:00
moxa
mscc net: mscc: ocelot: Fix use-after-free caused by cyclic delayed work 2025-10-06 11:12:52 -07:00
myricom treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
natsemi net: natsemi: fix `rx_dropped` double accounting on `netif_rx()` failure 2025-09-15 19:06:25 -07:00
neterion net: Fix typos 2025-07-25 10:29:07 -07:00
netronome Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2025-10-01 10:14:49 +02:00
ni
nvidia treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
nxp
oki-semi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
packetengines treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
pasemi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
pensando RDMA v6.18 merge window pull request 2025-10-03 18:35:22 -07:00
qlogic pci-v6.18-changes 2025-10-06 10:41:03 -07:00
qualcomm net: ethernet: qualcomm: QCOM_PPE should depend on ARCH_QCOM 2025-09-01 12:53:38 -07:00
rdc
realtek r8169: fix packet truncation after S4 resume on RTL8168H/RTL8111H 2025-10-13 17:33:56 -07:00
renesas net: ravb: Ensure memory write completes before ringing TX doorbell 2025-10-22 18:15:14 -07:00
rocker treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
samsung eth: sxgbe: migrate to new RXFH callbacks 2025-06-18 13:19:01 -07:00
seeq treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
sfc pci-v6.18-changes 2025-10-06 10:41:03 -07:00
sgi treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
silan
sis treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
smsc smsc911x: add second read of EEPROM mac when possible corruption seen 2025-09-04 19:09:44 -07:00
socionext
spacemit net: spacemit: Make stats_lock softirq-safe 2025-09-22 11:50:40 -07:00
stmicro net: stmmac: dwmac-rk: Fix disabling set_clock_selection 2025-10-16 17:12:46 -07:00
sun net: Fix typos 2025-07-25 10:29:07 -07:00
sunplus
synopsys treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
tehuti net: Fix typos 2025-07-25 10:29:07 -07:00
ti net: ethernet: ti: am65-cpts: fix timestamp loss due to race conditions 2025-10-21 12:26:11 +02:00
toshiba
tundra treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
vertexcom
via
wangxun net: libwx: restrict change user-set RSS configuration 2025-09-29 18:11:16 -07:00
wiznet net: WQ_PERCPU added to alloc_workqueue users 2025-09-22 17:40:30 -07:00
xilinx net: xilinx: axienet: Fix kernel-doc warnings for missing return descriptions 2025-09-22 16:37:36 -07:00
xircom xirc2ps_cs: fix register access when enabling FullDuplex 2025-08-29 19:05:11 -07:00
xscale
Kconfig net: spacemit: Add K1 Ethernet MAC 2025-09-16 12:43:49 +02:00
Makefile net: spacemit: Add K1 Ethernet MAC 2025-09-16 12:43:49 +02:00
dnet.c
dnet.h
ec_bhf.c
ethoc.c
fealnx.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
jme.c
jme.h
korina.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
lantiq_etop.c
lantiq_xrx200.c
oa_tc6.c net: ethernet: oa_tc6: Handle failure of spi_setup 2025-08-29 19:42:07 -07:00