Re: [syzbot] [net?] kernel BUG in __nla_validate_parse

From: Jakub Kicinski
Date: Sat Mar 09 2024 - 13:41:10 EST


On Sat, 9 Mar 2024 16:25:18 +0100 Eric Dumazet wrote:
> On Sat, Mar 9, 2024 at 4:13 PM syzbot
> > ..
> Petr, can you take a look ?
>
> Thanks !
>
>
> commit 2118f9390d83cf942de8b34faf3d35b54f9f4eee
> Author: Petr Machata <petrm@xxxxxxxxxx>
> Date: Wed Mar 6 13:49:15 2024 +0100
>
> net: nexthop: Adjust netlink policy parsing for a new attribute

Yeah

+static const struct nla_policy rtm_nh_policy_del[] = {
+ [NHA_ID] = { .type = NLA_U32 },
+};

+ err = nlmsg_parse(nlh, sizeof(struct nhmsg), tb, NHA_MAX,
+ rtm_nh_policy_del, extack);

The policy size must be >= max_attr (NHA_MAX).