Re: [PATCH net-next 3/4] netconsole: reject enabling a target with no remote IP address

Gustavo Luiz Duarte <[email protected]>
Newsgroups org.kernel.vger.linux-kernel,org.kernel.vger.netdev
Message-ID <CAGSyskUbYM9tK08AsUw9TQagv4Jj2y9ioXH9OrRtAyRzHSnu7A@mail.gmail.com>
On Thu, Aug 6, 2026 at 4:58 PM Breno Leitao <[email protected]> wrote:
>
> On Wed, Aug 05, 2026 at 10:33:03PM +0100, Gustavo Luiz Duarte wrote:
> > The command-line path already requires a remote address, but if a user
> > creates a dynamic target and enables it without setting a remote
> > address, we currently try sending netconsole traffic to "0.0.0.0".
> >
> > Refuse to enable a target if the remote address is unset.
> >
> > Signed-off-by: Gustavo Luiz Duarte <[email protected]>
> > ---
> >  drivers/net/netconsole.c | 6 ++++++
> >  1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
> > index 070bae7b4fd7..a41b0a5ce64f 100644
> > --- a/drivers/net/netconsole.c
> > +++ b/drivers/net/netconsole.c
> > @@ -471,6 +471,12 @@ static int netcons_netpoll_setup(struct netconsole_target *nt)
> >       int err;
> >
> >       rtnl_lock();
> > +     if (nt->remote_ip.family == AF_UNSPEC) {
> > +             np_err(np, "remote IP address not configured, aborting\n");
> > +             err = -EDESTADDRREQ;
> > +             goto unlock;
> > +     }
>
> Why not doing it  before the rtnl lock?

Oh, you are right, there is no reason for holding the lock here.
Thanks for pointing it out.
I will fix it in v2.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.