2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/net/wireless/microchip/wilc1000
Alexis Lothoré 208dea9107 wifi: wilc1000: unregister wiphy only after netdev registration
wiphy_unregister()/wiphy_free() has been recently decoupled from
wilc_netdev_cleanup() to fix a faulty error path in sdio/spi probe
functions. However this change introduced a new failure when simply
loading then unloading the driver:

  $ modprobe wilc1000-sdio; modprobe -r wilc1000-sdio
  WARNING: CPU: 0 PID: 115 at net/wireless/core.c:1145 wiphy_unregister+0x904/0xc40 [cfg80211]
  Modules linked in: wilc1000_sdio(-) wilc1000 cfg80211 bluetooth ecdh_generic ecc
  CPU: 0 UID: 0 PID: 115 Comm: modprobe Not tainted 6.13.0-rc6+ #45
  Hardware name: Atmel SAMA5
  Call trace:
   unwind_backtrace from show_stack+0x18/0x1c
   show_stack from dump_stack_lvl+0x44/0x70
   dump_stack_lvl from __warn+0x118/0x27c
   __warn from warn_slowpath_fmt+0xcc/0x140
   warn_slowpath_fmt from wiphy_unregister+0x904/0xc40 [cfg80211]
   wiphy_unregister [cfg80211] from wilc_sdio_remove+0xb0/0x15c [wilc1000_sdio]
   wilc_sdio_remove [wilc1000_sdio] from sdio_bus_remove+0x104/0x3f0
   sdio_bus_remove from device_release_driver_internal+0x424/0x5dc
   device_release_driver_internal from driver_detach+0x120/0x224
   driver_detach from bus_remove_driver+0x17c/0x314
   bus_remove_driver from sys_delete_module+0x310/0x46c
   sys_delete_module from ret_fast_syscall+0x0/0x1c
  Exception stack(0xd0acbfa8 to 0xd0acbff0)
  bfa0:                   0044b210 0044b210 0044b24c 00000800 00000000 00000000
  bfc0: 0044b210 0044b210 00000000 00000081 00000000 0044b210 00000000 00000000
  bfe0: 00448e24 b6af99c4 0043ea0d aea2e12c
  irq event stamp: 0
  hardirqs last  enabled at (0): [<00000000>] 0x0
  hardirqs last disabled at (0): [<c01588f0>] copy_process+0x1c4c/0x7bec
  softirqs last  enabled at (0): [<c0158944>] copy_process+0x1ca0/0x7bec
  softirqs last disabled at (0): [<00000000>] 0x0

The warning is triggered by the fact that there is still a
wireless_device linked to the wiphy we are unregistering, due to
wiphy_unregister() now being called after net device unregister (performed
in wilc_netdev_cleanup()). Fix this warning by moving wiphy_unregister()
after wilc_netdev_cleanup() is nominal paths (ie: driver removal).
wilc_netdev_cleanup() ordering is left untouched in error paths in probe
function because net device is not registered in those paths (so the
warning can not trigger), yet the wiphy can still be registered, and we
still some cleanup steps from wilc_netdev_cleanup().

Fixes: 1be94490b6 ("wifi: wilc1000: unregister wiphy only if it has been registered")
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://patch.msgid.link/20250114-wilc1000_modprobe-v1-1-ad19d46f0c07@bootlin.com
2025-01-15 18:24:33 +02:00
..
cfg80211.c wifi: cfg80211: send MLO links tx power info in GET_INTERFACE 2024-12-04 16:14:46 +01:00
cfg80211.h wifi: wilc1000: Register wiphy after reading out chipid 2024-10-17 19:47:42 +03:00
fw.h wifi: wilc1000: add function to read mac address from eFuse 2024-05-17 11:01:51 +03:00
hif.c wifi: wilc1000: fix potential RCU dereference issue in wilc_parse_join_bss_param 2024-09-09 15:28:47 +03:00
hif.h wifi: wilc1000: set wilc_set_mac_address parameter as const 2024-05-17 11:01:51 +03:00
Kconfig wilc1000: Add support for enabling CRC 2021-04-17 20:47:40 +03:00
Makefile wilc1000: use API version number info along with firmware filename 2020-07-14 20:52:27 +03:00
mon.c wifi: radiotap: Avoid -Wflex-array-member-not-at-end warnings 2024-10-08 21:24:20 +02:00
netdev.c wifi: wilc1000: unregister wiphy only if it has been registered 2025-01-10 14:49:45 +02:00
netdev.h wifi: wilc1000: remove suspend/resume from cfg80211 part 2024-06-18 13:23:16 +03:00
sdio.c wifi: wilc1000: unregister wiphy only after netdev registration 2025-01-15 18:24:33 +02:00
spi.c wifi: wilc1000: unregister wiphy only after netdev registration 2025-01-15 18:24:33 +02:00
wlan_cfg.c wifi: wilc1000: get correct length of string WID from received config packet 2022-07-27 15:58:10 +03:00
wlan_cfg.h wifi: wilc1000: Increase ASSOC response buffer 2023-05-11 15:53:44 +03:00
wlan_if.h wifi: wilc1000: Increase ASSOC response buffer 2023-05-11 15:53:44 +03:00
wlan.c wifi: wilc1000: Add WILC3000 support 2024-10-17 19:47:42 +03:00
wlan.h wifi: wilc1000: Add WILC3000 support 2024-10-17 19:47:42 +03:00