Re: [PATCH net-next v1 1/1] net: usb: lan78xx: fix WARN in __netif_napi_del_locked on disconnect
From: Jakub Kicinski
Date: Mon Jun 23 2025 - 19:55:50 EST
On Fri, 20 Jun 2025 10:51:44 +0200 Oleksij Rempel wrote:
> A WARN may be triggered in __netif_napi_del_locked() during USB device
> disconnect:
>
> WARNING: CPU: 0 PID: 11 at net/core/dev.c:7417 __netif_napi_del_locked+0x2b4/0x350
>
> This occurs because NAPI remains enabled when the device is unplugged and
> teardown begins. While `napi_disable()` was previously called in the
> `lan78xx_stop()` path, that function is not invoked on disconnect. Instead,
> when using PHYLINK, the `mac_link_down()` callback is guaranteed to run
> during disconnect, making it the correct place to disable NAPI.
>
> Similarly, move `napi_enable()` to `mac_link_up()` to pair the lifecycle
> with actual MAC state.
Stopping and starting NAPI on link events is pretty unusual.
The problem is the disconnect handling, unregistering netdev
removes the NAPIs automatically, I think all you need is to
remove the explicit netif_napi_del() in lan78xx_disconnect().
Core will call _stop (which disables the NAPI), and then
it will del the NAPI.
> This patch is intended for `net-next` since the issue existed before the
> PHYLINK migration, but is more naturally and cleanly addressed now that
> PHYLINK manages link state transitions.
And repost that for net, please.. :)
--
pw-bot: cr