All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <edumazet@google.com>
To: David Ahern <dsahern@gmail.com>
Cc: Eric Dumazet <eric.dumazet@gmail.com>,
	"David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
	Roopa Prabhu <roopa@nvidia.com>
Subject: Re: [PATCH net] net, neigh: clear whole pneigh_entry at alloc time
Date: Wed, 8 Dec 2021 10:36:25 -0800	[thread overview]
Message-ID: <CANn89iLcHVUW1jHjWesL+Esi-tE3OJNEv5h=riuZq3jA1n+jhw@mail.gmail.com> (raw)
In-Reply-To: <ded3d280-efcd-810e-c29c-7296f97cb181@gmail.com>

On Wed, Dec 8, 2021 at 7:54 AM David Ahern <dsahern@gmail.com> wrote:
>
> On 12/6/21 9:53 AM, Eric Dumazet wrote:
> > From: Eric Dumazet <edumazet@google.com>
> >
> > Commit 2c611ad97a82 ("net, neigh: Extend neigh->flags to 32 bit
> > to allow for extensions") enables a new KMSAM warning [1]
> >
> > I think the bug is actually older, because the following intruction
> > only occurred if ndm->ndm_flags had NTF_PROXY set.
> >
> >       pn->flags = ndm->ndm_flags;
> >
> > Let's clear all pneigh_entry fields at alloc time.
> >
>
> All of the fields - except the new flags field - are initialized after
> the alloc. Why do you think the bug is older?

Because the flags field was added earlier, in the commit I pointed in Fixes: tag

For some reason, syzbot found the issue only after Roopa patch went in.
But we need to backport to older versions I think, or risk a kernel-info-leak

>
> ...
>
> > Fixes: 62dd93181aaa ("[IPV6] NDISC: Set per-entry is_router flag in Proxy NA.")
> > Signed-off-by: Eric Dumazet <edumazet@google.com>
> > Cc: Roopa Prabhu <roopa@nvidia.com>
> > ---
> >  net/core/neighbour.c | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/net/core/neighbour.c b/net/core/neighbour.c
> > index 72ba027c34cfea6f38a9e78927c35048ebfe7a7f..dda12fbd177ba6ad2798ea2b07733fa3f03441ab 100644
> > --- a/net/core/neighbour.c
> > +++ b/net/core/neighbour.c
> > @@ -763,11 +763,10 @@ struct pneigh_entry * pneigh_lookup(struct neigh_table *tbl,
> >
> >       ASSERT_RTNL();
> >
> > -     n = kmalloc(sizeof(*n) + key_len, GFP_KERNEL);
> > +     n = kzalloc(sizeof(*n) + key_len, GFP_KERNEL);
> >       if (!n)
> >               goto out;
> >
> > -     n->protocol = 0;
> >       write_pnet(&n->net, net);
> >       memcpy(n->key, pkey, key_len);
> >       n->dev = dev;
> >
>
> Reviewed-by: David Ahern <dsahern@kernel.org>

  reply	other threads:[~2021-12-08 18:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-06 16:53 [PATCH net] net, neigh: clear whole pneigh_entry at alloc time Eric Dumazet
2021-12-08 15:53 ` David Ahern
2021-12-08 18:36   ` Eric Dumazet [this message]
2021-12-09  2:00 ` patchwork-bot+netdevbpf

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='CANn89iLcHVUW1jHjWesL+Esi-tE3OJNEv5h=riuZq3jA1n+jhw@mail.gmail.com' \
    --to=edumazet@google.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=eric.dumazet@gmail.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=roopa@nvidia.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.