linux/drivers/net/wireless
Mikhail Gavrilov 3aa1dcaa4f Revert "wifi: mt76: Disable napi when removing device"
This reverts commit 13b7e6a96a.

That commit made mt76_dma_cleanup() disable every RX NAPI instance before
deleting it, to silence WARNs in __netif_napi_del_locked() and
page_pool_disable_direct_recycling() seen when unloading mt7915e with an
MT7916.

On mt7921e and mt7925e the same instances are already disabled earlier,
in mt7921e_unregister_device() and mt7925e_unregister_device(), which
only afterwards call mt792x_dma_cleanup() -> mt76_dma_cleanup().  Each
instance is therefore disabled twice, and napi_disable() is not
idempotent: on return it leaves NAPIF_STATE_SCHED and NAPIF_STATE_NPSVC
set, so the second call spins in usleep_range() forever, waiting for bits
that nobody will clear.

mt7921_pci_shutdown() and mt7925_pci_shutdown() reuse the remove path, so
this is hit on every reboot, poweroff and module unload.  It is silent:
the stuck task keeps sleeping and rescheduling, so neither the hung task
detector nor the lockup detectors fire, and the last line on the console
is "systemd-shutdown[1]: Rebooting."

  task:modprobe        state:D stack:25720 pid:7954  tgid:7954
  Call Trace:
   <TASK>
   __schedule+0x11b8/0x26d0
   schedule+0xe7/0x2f0
   schedule_hrtimeout_range_clock+0x218/0x330
   usleep_range_state+0x133/0x1b0
   napi_disable_locked+0x37d/0x5f0
   napi_disable+0x43/0x80
   mt76_dma_cleanup+0x2b4/0x860 [mt76]
   mt7921_pci_remove+0x17f/0x350 [mt7921e]
   pci_device_remove+0xb6/0x1e0
   device_release_driver_internal+0x38d/0x540
   driver_detach+0xd0/0x1b0
   bus_remove_driver+0x127/0x2d0
   pci_unregister_driver+0x2a/0x280
   __do_sys_delete_module+0x36a/0x5b0
   do_syscall_64+0x11c/0x6d0
   entry_SYSCALL_64_after_hwframe+0x76/0x7e
   </TASK>

Dropping the two driver-side loops instead was tried and rejected: with
them gone, the RX poll can reach mt76_token_release() via
PKT_TYPE_TXRX_NOTIFY and mt7921_mac_tx_free() while
mt76_connac2_tx_token_put() is running idr_destroy(&dev->token) outside
token_lock, which is a use-after-free rather than a hang [1].

Revert for now, so that reboot, poweroff and module unload work again.
The WARNs on mt7915e are a less severe problem than an unbootable
machine, and fixing them belongs in the drivers that delete the NAPI
instances, where each one can pick a point that is safe for its own
teardown order, rather than in the shared mt76_dma_cleanup().

[ This is the "landing soonish" known regression fix mentioned in the
  previous networking merge commit       - Linus ]

Reported-by: Bert Karwatzki <spasswolf@web.de>
Closes: https://lore.kernel.org/all/20260724151419.26014-1-spasswolf@web.de/
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221818
Link: https://lore.kernel.org/all/20260730050428.GA73812@sol/ [1]
Signed-off-by: Mikhail Gavrilov <mikhail.v.gavrilov@gmail.com>
Acked-by: Nicolas Cavallari <nicolas.cavallari@green-communications.fr>
Fixes: 13b7e6a96a ("wifi: mt76: Disable napi when removing device")
Tested-by: Devin Wittmayer <lucid_duck@justthetip.ca>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
History 2026-08-13 09:00:55 -07:00
..
admtek wifi: cfg80211/mac80211: Add support to get radio index 2025-06-24 15:19:27 +02:00
ath wifi: ath12k: resolve PENDING ML peer ID from MLO_PEER_MAP HTT event 2026-07-27 08:00:43 -07:00
atmel wifi: at76c50x-usb: avoid length underflow in at76_guess_freq() 2026-07-21 13:27:38 +02:00
broadcom wifi: brcmfmac: fix 802.1X-SHA256 call trace warning 2026-07-22 11:18:02 +02:00
intel wifi: iwlegacy: replace BUG_ON() with WARN_ON() on num_stations check 2026-07-28 15:35:37 +02:00
intersil Too many robustness fixes to list. Mostly for 2026-07-10 16:27:45 +02:00
marvell wifi: mwifiex: use the subframe length when parsing A-MSDU TDLS frames 2026-07-28 15:07:45 +02:00
mediatek Revert "wifi: mt76: Disable napi when removing device" 2026-08-13 09:00:55 -07:00
microchip wifi: wilc1000: validate assoc response length before subtracting header 2026-07-21 13:25:06 +02:00
purelifi wifi: plfxlc: use module_usb_driver() macro 2026-05-20 11:58:39 +02:00
quantenna wifi: qtnfmac: topaz: defer IRQ enabling until IPC init 2026-06-03 14:11:56 +02:00
ralink wifi: ralink: RT2X00: init EEPROM properly 2026-07-06 14:11:08 +02:00
realtek bitmap updates for v7.2 2026-06-17 11:38:38 +01:00
rsi wifi: rsi: validate beacon length before fixed buffer copy 2026-07-06 14:11:09 +02:00
silabs wifi: move action code from per-type frame structs 2026-03-06 10:36:26 +01:00
st wifi: cw1200: Revert "Fix locking in error paths" 2026-05-04 09:08:24 +02:00
ti Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
virtual wifi: mac80211_hwsim: reject undersized HWSIM_ATTR_TX_INFO 2026-07-21 14:09:21 +02:00
zydas Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
Kconfig wifi: remove orphaned rndis_wlan driver 2023-10-30 19:30:33 +02:00
Makefile wifi: remove orphaned rndis_wlan driver 2023-10-30 19:30:33 +02:00