[PATCH net v5 4/4] netconsole: stop waiting for carrier once the device is unregistered
From: Gustavo Luiz Duarte
Date: Mon Nov 02 2026 - 17:19:39 EST
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@xxxxxxxxx
Signed-off-by: Gustavo Luiz Duarte <gustavold@xxxxxxxxx>
---
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