On Tue, Nov 10, 2026 at 01:42:17AM +0000, netdev-bot+sashiko@kernel.org wrote:
Thank you for your contribution! Sashiko AI review found 4 potential
[Severity: High]
This isn't a bug introduced by this patch, but this patch now registers
a console right after this lockless store of STATE_ENABLED. Can the store
overwrite a deactivation done at the same time by a NETDEV_UNREGISTER?
By the time we get here, netcons_netpoll_setup() has published np.dev,
dropped the RTNL and waited for a grace period:
drivers/net/netconsole.c:netcons_netpoll_setup() {
...
err = __netpoll_setup(np, ndev);
if (err)
goto put;
rtnl_unlock();
...
synchronize_rcu();
...
}
The target is on target_list during that window, so this sequence looks
possible:
enabled_store() NETDEV_UNREGISTER
netcons_netpoll_setup()
rtnl_unlock()
synchronize_rcu() netconsole_netdev_event()
nt->state = STATE_DEACTIVATED;
list_move(..., &target_cleanup_list);
netconsole_process_cleanups_core()
netcons_release_dev()
do_netpoll_cleanup()
np->dev = NULL
target back on target_list
nt->state = STATE_ENABLED;
netconsole_register_console()
The next netconsole_write() would pass the state check and call
netif_running() with a NULL dev:
if (nt->state != STATE_ENABLED || !netif_running(nt->np.dev))
return;
process_resume_target() handles this race with the reg_state re-check
under the RTNL, but enabled_store() has no such check. Does it need one?
I understand that this one got fixed by Gustavo's commit f94b9640bcf22b
("netconsole: finish enabling the target before releasing RTNL")