Skip to content

Commit cbbdf84

Browse files
dsaherndavem330
authored andcommitted
netlink: extack needs to be reset each time through loop
syzbot triggered the WARN_ON in netlink_ack testing the bad_attr value. The problem is that netlink_rcv_skb loops over the skb repeatedly invoking the callback and without resetting the extack leaving potentially stale data. Initializing each time through avoids the WARN_ON. Fixes: 2d4bc93 ("netlink: extended ACK reporting") Reported-by: [email protected] Signed-off-by: David Ahern <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 59b3661 commit cbbdf84

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netlink/af_netlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2384,7 +2384,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
23842384
struct nlmsghdr *,
23852385
struct netlink_ext_ack *))
23862386
{
2387-
struct netlink_ext_ack extack = {};
2387+
struct netlink_ext_ack extack;
23882388
struct nlmsghdr *nlh;
23892389
int err;
23902390

@@ -2405,6 +2405,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
24052405
if (nlh->nlmsg_type < NLMSG_MIN_TYPE)
24062406
goto ack;
24072407

2408+
memset(&extack, 0, sizeof(extack));
24082409
err = cb(skb, nlh, &extack);
24092410
if (err == -EINTR)
24102411
goto skip;

0 commit comments

Comments
 (0)