From: Breno Leitao <leitao@debian.org>
To: netdev-bot+sashiko@kernel.org, gustavold@gmail.com
Cc: gustavold@gmail.com, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
john.ogness@linutronix.de, pmladek@suse.com,
samuelcrossley@gmail.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH net-next] netconsole: register one console per target
Date: Tue, 10 Nov 2026 03:25:02 -0800 [thread overview]
Message-ID: <avL-47QDYmOHN9Pv@gmail.com> (raw)
In-Reply-To: <179427493788.994134.10458088525635523245@kernel.org>
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")
prev parent reply other threads:[~2026-11-10 11:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-06 13:16 Breno Leitao
2026-11-10 1:42 ` netdev-bot+sashiko
2026-11-10 11:25 ` Breno Leitao [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=avL-47QDYmOHN9Pv@gmail.com \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=gustavold@gmail.com \
--cc=john.ogness@linutronix.de \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pmladek@suse.com \
--cc=samuelcrossley@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®