linux/drivers/net
Cosmin Ratiu 4dbc1d1a9f net/mlx5e: Don't call cleanup on profile rollback failure
When profile rollback fails in mlx5e_netdev_change_profile, the netdev
profile var is left set to NULL. Avoid a crash when unloading the driver
by not calling profile->cleanup in such a case.

This was encountered while testing, with the original trigger that
the wq rescuer thread creation got interrupted (presumably due to
Ctrl+C-ing modprobe), which gets converted to ENOMEM (-12) by
mlx5e_priv_init, the profile rollback also fails for the same reason
(signal still active) so the profile is left as NULL, leading to a crash
later in _mlx5e_remove.

 [  732.473932] mlx5_core 0000:08:00.1: E-Switch: Unload vfs: mode(OFFLOADS), nvfs(2), necvfs(0), active vports(2)
 [  734.525513] workqueue: Failed to create a rescuer kthread for wq "mlx5e": -EINTR
 [  734.557372] mlx5_core 0000:08:00.1: mlx5e_netdev_init_profile:6235:(pid 6086): mlx5e_priv_init failed, err=-12
 [  734.559187] mlx5_core 0000:08:00.1 eth3: mlx5e_netdev_change_profile: new profile init failed, -12
 [  734.560153] workqueue: Failed to create a rescuer kthread for wq "mlx5e": -EINTR
 [  734.589378] mlx5_core 0000:08:00.1: mlx5e_netdev_init_profile:6235:(pid 6086): mlx5e_priv_init failed, err=-12
 [  734.591136] mlx5_core 0000:08:00.1 eth3: mlx5e_netdev_change_profile: failed to rollback to orig profile, -12
 [  745.537492] BUG: kernel NULL pointer dereference, address: 0000000000000008
 [  745.538222] #PF: supervisor read access in kernel mode
<snipped>
 [  745.551290] Call Trace:
 [  745.551590]  <TASK>
 [  745.551866]  ? __die+0x20/0x60
 [  745.552218]  ? page_fault_oops+0x150/0x400
 [  745.555307]  ? exc_page_fault+0x79/0x240
 [  745.555729]  ? asm_exc_page_fault+0x22/0x30
 [  745.556166]  ? mlx5e_remove+0x6b/0xb0 [mlx5_core]
 [  745.556698]  auxiliary_bus_remove+0x18/0x30
 [  745.557134]  device_release_driver_internal+0x1df/0x240
 [  745.557654]  bus_remove_device+0xd7/0x140
 [  745.558075]  device_del+0x15b/0x3c0
 [  745.558456]  mlx5_rescan_drivers_locked.part.0+0xb1/0x2f0 [mlx5_core]
 [  745.559112]  mlx5_unregister_device+0x34/0x50 [mlx5_core]
 [  745.559686]  mlx5_uninit_one+0x46/0xf0 [mlx5_core]
 [  745.560203]  remove_one+0x4e/0xd0 [mlx5_core]
 [  745.560694]  pci_device_remove+0x39/0xa0
 [  745.561112]  device_release_driver_internal+0x1df/0x240
 [  745.561631]  driver_detach+0x47/0x90
 [  745.562022]  bus_remove_driver+0x84/0x100
 [  745.562444]  pci_unregister_driver+0x3b/0x90
 [  745.562890]  mlx5_cleanup+0xc/0x1b [mlx5_core]
 [  745.563415]  __x64_sys_delete_module+0x14d/0x2f0
 [  745.563886]  ? kmem_cache_free+0x1b0/0x460
 [  745.564313]  ? lockdep_hardirqs_on_prepare+0xe2/0x190
 [  745.564825]  do_syscall_64+0x6d/0x140
 [  745.565223]  entry_SYSCALL_64_after_hwframe+0x4b/0x53
 [  745.565725] RIP: 0033:0x7f1579b1288b

Fixes: 3ef14e463f ("net/mlx5e: Separate between netdev objects and mlx5e profiles initialization")
Signed-off-by: Cosmin Ratiu <cratiu@nvidia.com>
Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
2024-10-17 12:14:07 +02:00
..
arcnet
bonding bonding: Fix unnecessary warnings and logs from bond_xdp_get_xmit_slave() 2024-09-24 15:19:50 +02:00
caif
can move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
dsa net: dsa: vsc73xx: fix reception from VLAN-unaware bridges 2024-10-15 18:41:52 -07:00
ethernet net/mlx5e: Don't call cleanup on profile rollback failure 2024-10-17 12:14:07 +02:00
fddi
fjes minmax: make generic MIN() and MAX() macros available everywhere 2024-07-28 15:49:18 -07:00
hamradio TTY/Serial driver update for 6.12-rc1 2024-09-26 09:59:50 -07:00
hippi
hyperv net: netvsc: Update default VMBus channels 2024-08-28 17:18:32 -07:00
ieee802154 Including fixes from ieee802154, bluetooth and netfilter. 2024-10-03 09:44:00 -07:00
ipa net: ipa: make use of dev_err_cast_probe() 2024-08-29 11:41:05 -07:00
ipvlan netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
mctp move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
mdio net: phy: mdio-bcm-unimac: Add BCM6846 support 2024-10-15 18:23:53 -07:00
netdevsim netdevsim: use cond_resched() in nsim_dev_trap_report_work() 2024-10-15 09:58:43 -07:00
pcs net: pcs: xpcs: fix the wrong register that was written back 2024-10-01 11:00:50 +02:00
phy net: phy: realtek: Fix MMD access on RTL8126A-integrated PHY 2024-10-09 12:43:46 +01:00
plip
ppp ppp: fix ppp_async_encode() illegal access 2024-10-10 08:47:13 -07:00
pse-pd net: pse-pd: Fix enabled status mismatch 2024-10-04 13:14:18 -07:00
slip slip: make slhc_remember() more robust against malicious packets 2024-10-10 09:06:32 -07:00
team netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
thunderbolt
usb net: usb: usbnet: fix race in probe failure 2024-10-15 11:37:25 +02:00
vmxnet3 vmxnet3: Fix packet corruption in vmxnet3_xdp_xmit_frame 2024-10-17 11:27:17 +02:00
vxlan vxlan: Handle error of rtnl_register_module(). 2024-10-10 15:39:35 +02:00
wan net: wan: fsl_qmc_hdlc: Discard received CRC 2024-07-31 18:09:08 -07:00
wireguard netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
wireless move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
wwan net: wwan: qcom_bam_dmux: Fix missing pm_runtime_disable() 2024-09-27 12:39:02 +01:00
xen-netback net/xen-netback: prevent UAF in xenvif_flush_hash() 2024-08-28 17:07:42 -07:00
amt.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
bareudp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-09-15 09:13:19 -07:00
dummy.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
eql.c
geneve.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
gtp.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
ifb.c
Kconfig
LICENSE.SRC
loopback.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
macsec.c macsec: don't increment counters for an unrelated SA 2024-10-15 09:57:03 -07:00
macvlan.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
macvtap.c
Makefile
mdio.c
mhi_net.c
mii.c
net_failover.c netdev_features: convert NETIF_F_NETNS_LOCAL to dev->netns_local 2024-09-03 11:36:43 +02:00
netconsole.c net: netconsole: fix wrong warning 2024-10-09 19:42:43 -07:00
netkit.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2024-09-15 09:13:19 -07:00
nlmon.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
ntb_netdev.c
pfcp.c
rionet.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
sb1000.c
Space.c
sungem_phy.c net: sungem_phy: Constify struct mii_phy_def 2024-08-08 19:59:06 -07:00
tap.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
tun.c [tree-wide] finally take no_llseek out 2024-09-27 08:18:43 -07:00
veth.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
virtio_net.c virtio_net: Fix mismatched buf address when unmapping for small packets 2024-09-26 10:35:27 +02:00
vrf.c vrf: revert "vrf: Remove unnecessary RCU-bh critical section" 2024-10-02 17:26:11 -07:00
vsockmon.c netdev_features: convert NETIF_F_LLTX to dev->lltx 2024-09-03 11:36:43 +02:00
xen-netfront.c