[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAO9wTFjaLBbrT7JKBBN=2NMhSRmxzPk_jLSuG=i6Y5anZJnvEA@mail.gmail.com>
Date: Tue, 18 Feb 2025 00:34:59 +0530
From: Suchit K <suchitkarunakaran@...il.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, horms@...nel.org,
skhan@...uxfoundation.org, linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linux.dev
Subject: Re: [PATCH] net: dev_addr_list: add address length validation in
__hw_addr_insert function
Hi Eric,
Thanks for the feedback! I'm new to kernel development and still
finding my way around.
I wasn't working from a syzbot report on this one; I was just
exploring the code and felt there is no parameter validation. I went
ahead and made this change based on that impression. I realized my
changelog should have been more generic. Sorry about that. Also since
it's not based on a syzbot report, is it good to have this change?
Your insights and suggestions would be most welcome. I will make the
required changes accordingly.
Thanks.
On Mon, 17 Feb 2025 at 23:58, Eric Dumazet <edumazet@...gle.com> wrote:
>
> On Mon, Feb 17, 2025 at 5:54 PM Suchit K <suchitkarunakaran@...il.com> wrote:
> >
> > Add validation checks for hardware address length in
> > __hw_addr_insert() to prevent problems with invalid lengths.
> >
> > Signed-off-by: Suchit Karunakaran <suchitkarunakaran@...il.com>
> > ---
> > net/core/dev_addr_lists.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/net/core/dev_addr_lists.c b/net/core/dev_addr_lists.c
> > index 90716bd73..b6b906b2a 100644
> > --- a/net/core/dev_addr_lists.c
> > +++ b/net/core/dev_addr_lists.c
> > @@ -21,6 +21,9 @@
> > static int __hw_addr_insert(struct netdev_hw_addr_list *list,
> > struct netdev_hw_addr *new, int addr_len)
> > {
> > + if (!list || !new || addr_len <= 0 || addr_len > MAX_ADDR_LEN)
> > + return -EINVAL;
> > +
>
> We do not put code before variable declarations.
>
> Also, why @list would be NULL, or @new being NULL ?
> This does not match the changelog.
>
> > struct rb_node **ins_point = &list->tree.rb_node, *parent = NULL;
> > struct netdev_hw_addr *ha;
> >
>
> Any syzbot report to share with us ?
>
> Also, a Fixes: tag would be needed.
Powered by blists - more mailing lists