Re: [PATCH net v5 3/4] netconsole: recheck device registration after waiting for carrier
From: Breno Leitao
Date: Tue Nov 03 2026 - 08:30:30 EST
On Mon, Nov 02, 2026 at 07:54:51PM +0000, Gustavo Luiz Duarte wrote:
> netcons_netpoll_setup() drops RTNL while it waits for carrier when the
> device is not yet up. If the device is unregistered in that window, the
> NETDEV_UNREGISTER notifier runs before np->dev is set and has nothing
> to match.
>
> We might then end up setting up netpoll on a device that is being
> unregistered while holding a reference to it, stalling
> unregister_netdevice() in netdev_wait_allrefs_any().
>
> Add a check to confirm the device is still registered once we retake
> RTNL. Release the device reference and return -ENODEV otherwise.
>
> Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261012-netcons-fixes-v3-1-1aac85ed7665@xxxxxxxxx
> Signed-off-by: Gustavo Luiz Duarte <gustavold@xxxxxxxxx>
Reviewed-by: Breno Leitao <leitao@xxxxxxxxxx>