Skip to content

Commit

Permalink
netlink: extack needs to be reset each time through loop
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
dsahern authored and davem330 committed Jan 15, 2018
1 parent 59b3661 commit cbbdf84
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -2384,7 +2384,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *,
struct nlmsghdr *,
struct netlink_ext_ack *))
{
struct netlink_ext_ack extack = {};
struct netlink_ext_ack extack;
struct nlmsghdr *nlh;
int err;

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

memset(&extack, 0, sizeof(extack));
err = cb(skb, nlh, &extack);
if (err == -EINTR)
goto skip;
Expand Down

0 comments on commit cbbdf84

Please sign in to comment.