linux/drivers/net
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>
2026-08-13 09:00:55 -07:00
..
arcnet net: arcnet: com20020-pci: avoid -Wformat-truncation warning 2026-05-22 17:20:57 -07:00
bonding bonding: alb: re-check primary_is_promisc under RTNL in bond_alb_monitor 2026-07-30 16:16:48 -07:00
can can: ems_usb: validate CPC message lengths 2026-07-29 12:00:18 +02:00
dsa net: dsa: realtek: use devm_mutex_init for l2_lock 2026-07-29 18:42:27 -07:00
ethernet net: ethernet: ti: am65-cpsw-nuss: Fix port_id extraction from SRC TAG 2026-08-12 17:36:19 -07:00
fddi FDDI: defza: Sanitise the reset safety timer 2026-05-13 17:31:01 -07:00
fjes net: fjes: Drop fjes_acpi_driver and rework initialization 2026-03-19 17:20:55 -07:00
hyperv hv_netvsc: use kmap_local_page in netvsc_copy_to_send_buf 2026-06-09 13:16:30 +02:00
ieee802154 Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
ipa net: ipa: fix SMEM state handle leaks in SMP2P init 2026-06-26 18:40:04 -07:00
ipvlan ipvlan: inherit needed_headroom and needed_tailroom from phy_dev 2026-08-10 15:20:06 -07:00
mctp mctp: serial: handle zero-length frames to prevent rx buffer overflow 2026-07-23 15:34:00 +02:00
mdio Including fixes from netfilter, Bluetooth and batman-adv. 2026-07-09 08:26:51 -07:00
netdevsim netdevsim: remove ethtool debugfs files before freeing netdev 2026-06-29 18:47:23 -07:00
ovpn ovpn: defer key slot crypto freeing to workqueue 2026-08-09 22:47:57 +02:00
pcs net: pcs: xpcs: fix SGMII state reading 2026-07-23 08:22:21 -07:00
phy net: phy: realtek: fix EEE advertisement write on the internal PHY MMD path 2026-08-10 16:05:05 -07:00
plip
ppp pppoe: reload header pointer after dev_hard_header() 2026-07-23 07:01:53 -07:00
pse-pd net: pse-pd: scope pse_control regulator handle to kref lifetime 2026-06-26 18:43:09 -07:00
slip net: slip: serialize receive against buffer reallocation 2026-07-23 09:06:48 -07:00
team net: team: don't recurse on the port's netdev ops lock 2026-06-04 14:04:55 -07:00
thunderbolt net: thunderbolt: Tear down DMA paths before stopping the rings 2026-08-06 08:19:53 -07:00
usb net: usb: ipheth: fix carrier_work UAF on disconnect 2026-08-06 08:21:57 -07:00
vmxnet3 vmxnet3: fix BUG_ON in vmxnet3_get_hdr_len() for Geneve packets 2026-07-22 13:52:44 -07:00
vxlan vxlan: do not arm the ageing timer on a device that is down 2026-08-11 11:42:52 +02:00
wan wan: wanxl: Only reset hardware after BAR mapping 2026-07-21 13:12:43 +02:00
wireguard Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-01 13:42:12 +02:00
wireless Revert "wifi: mt76: Disable napi when removing device" 2026-08-13 09:00:55 -07:00
wwan Split <linux/mod_devicetable.h> in per subsystem headers 2026-07-02 20:54:26 -10:00
xen-netback
amt.c amt: fix use-after-free in AMT delayed works 2026-07-23 07:00:35 -07:00
bareudp.c bareudp: Use rtnl_dereference() in bareudp_sock_release(). 2026-05-20 19:12:29 -07:00
dummy.c net: change ndo_set_rx_mode_async return type to int 2026-06-09 18:15:29 -07:00
eql.c
geneve.c geneve: require CAP_NET_ADMIN in the device netns for changelink 2026-07-23 08:17:09 -07:00
gtp.c gtp: check skb_pull_data() return in gtp1u_send_echo_resp() 2026-07-21 15:02:29 -07:00
ifb.c net: ifb: report ethtool stats over num_tx_queues 2026-05-14 18:40:04 -07:00
Kconfig ne2k: fold drivers/net/Space.c into ne.c 2026-05-01 16:46:53 -07:00
LICENSE.SRC
loopback.c
macsec.c macsec: fix promiscuity refcount leak in macsec_dev_open() 2026-07-11 12:52:15 +02:00
macvlan.c macvlan: inherit needed_headroom and needed_tailroom from lowerdev 2026-08-10 15:21:41 -07:00
macvtap.c kernfs: pass struct ns_common instead of const void * for namespace tags 2026-04-09 14:36:52 +02:00
Makefile ne2k: fold drivers/net/Space.c into ne.c 2026-05-01 16:46:53 -07:00
mdio.c
mhi_net.c Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00
mii.c
net_failover.c net: net_failover: Fix the deadlock in slave register 2026-05-13 19:01:03 -07:00
netconsole.c netconsole: don't drop the last byte of a full-sized message 2026-06-18 18:08:41 -07:00
netkit.c net: change ndo_set_rx_mode_async return type to int 2026-06-09 18:15:29 -07:00
nlmon.c
ntb_netdev.c NTB: ntb_netdev: Preserve RX queue depth on allocation failure 2026-08-11 11:04:55 +02:00
pfcp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2026-06-16 14:59:58 -07:00
rionet.c
sungem_phy.c
tap.c net: tap: fix wrong transport_header when sending VLAN-tagged frame 2026-08-11 13:14:00 +02:00
tun_vnet.h virtio-net: correct hdr_len handling for VIRTIO_NET_F_GUEST_HDRLEN 2026-03-24 11:12:07 +01:00
tun.c Revert "tun/tap: add ptr_ring consume helper with netdev queue wakeup" 2026-07-29 17:12:27 -07:00
veth.c veth: fix queue index used to wake the peer txq in veth_poll 2026-08-10 15:57:47 -07:00
virtio_net.c virtio_net: disable cb when NAPI is busy-polled 2026-06-30 17:03:37 -07:00
vrf.c vrf: Fix a potential NPD when removing a port from a VRF 2026-04-27 17:43:22 -07:00
vsockmon.c
xen-netfront.c