[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a92e609b-f5c4-4e9a-8eb8-7e2c54f75215@kernel.org>
Date: Sun, 10 Mar 2024 11:54:59 -0600
From: David Ahern <dsahern@...nel.org>
To: Ido Schimmel <idosch@...dia.com>, netdev@...r.kernel.org
Cc: davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
edumazet@...gle.com, petrm@...dia.com
Subject: Re: [PATCH net-next 1/2] nexthop: Fix out-of-bounds access during
attribute validation
On 3/10/24 11:32 AM, Ido Schimmel wrote:
> diff --git a/net/ipv4/nexthop.c b/net/ipv4/nexthop.c
> index 5eb3ba568f4e..f3df80d2b980 100644
> --- a/net/ipv4/nexthop.c
> +++ b/net/ipv4/nexthop.c
> @@ -3253,8 +3253,9 @@ static int rtm_del_nexthop(struct sk_buff *skb, struct nlmsghdr *nlh,
> int err;
> u32 id;
>
> - err = nlmsg_parse(nlh, sizeof(struct nhmsg), tb, NHA_MAX,
> - rtm_nh_policy_del, extack);
> + err = nlmsg_parse(nlh, sizeof(struct nhmsg), tb,
> + ARRAY_SIZE(rtm_nh_policy_del) - 1, rtm_nh_policy_del,
'tb' on the stack only needs to be ARRAY_SIZE as well; that's the
benefit of the approach - only declare what you need.
Comment applies to the other locations as well.
Powered by blists - more mailing lists