netcons_netpoll_setup() releases RTNL and waits in netcons_wait_carrier() for up to carrier_timeout seconds for the device to report carrier. If the device is unregistered in the meantime, the loop keeps polling until the timeout expires. Stop waiting as soon as the device is no longer NETREG_REGISTERED. Closes: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261021-netcons-fixes-v4-0-3857120c6340@gmail.com Signed-off-by: Gustavo Luiz Duarte --- drivers/net/netconsole.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c index 238acf300d23..895d33b179e7 100644 --- a/drivers/net/netconsole.c +++ b/drivers/net/netconsole.c @@ -383,6 +383,8 @@ static void netcons_wait_carrier(struct netpoll *np, struct net_device *ndev) atmost = jiffies + netpoll_get_carrier_timeout() * HZ; while (!netif_carrier_ok(ndev)) { + if (READ_ONCE(ndev->reg_state) != NETREG_REGISTERED) + break; if (time_after(jiffies, atmost)) { np_notice(np, "timeout waiting for carrier\n"); break; -- 2.56.0