diff options
author | Xin Long <lucien.xin@gmail.com> | 2018-01-18 01:48:03 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-01-18 15:14:51 -0500 |
commit | cd443f1e91ca600a092e780e8250cd6a2954b763 (patch) | |
tree | f76635f6578e3aaab43c44704889cbc27b788220 /net/netlink | |
parent | 7155f8f391576f133ed26c8d6bb8c7f03ceb404a (diff) |
netlink: reset extack earlier in netlink_rcv_skb
Move up the extack reset/initialization in netlink_rcv_skb, so that
those 'goto ack' will not skip it. Otherwise, later on netlink_ack
may use the uninitialized extack and cause kernel crash.
Fixes: cbbdf8433a5f ("netlink: extack needs to be reset each time through loop")
Reported-by: syzbot+03bee3680a37466775e7@syzkaller.appspotmail.com
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Acked-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r-- | net/netlink/af_netlink.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index 47ef2d8683d6..84a4e4c3be4b 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -2391,6 +2391,7 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, | |||
2391 | while (skb->len >= nlmsg_total_size(0)) { | 2391 | while (skb->len >= nlmsg_total_size(0)) { |
2392 | int msglen; | 2392 | int msglen; |
2393 | 2393 | ||
2394 | memset(&extack, 0, sizeof(extack)); | ||
2394 | nlh = nlmsg_hdr(skb); | 2395 | nlh = nlmsg_hdr(skb); |
2395 | err = 0; | 2396 | err = 0; |
2396 | 2397 | ||
@@ -2405,7 +2406,6 @@ int netlink_rcv_skb(struct sk_buff *skb, int (*cb)(struct sk_buff *, | |||
2405 | if (nlh->nlmsg_type < NLMSG_MIN_TYPE) | 2406 | if (nlh->nlmsg_type < NLMSG_MIN_TYPE) |
2406 | goto ack; | 2407 | goto ack; |
2407 | 2408 | ||
2408 | memset(&extack, 0, sizeof(extack)); | ||
2409 | err = cb(skb, nlh, &extack); | 2409 | err = cb(skb, nlh, &extack); |
2410 | if (err == -EINTR) | 2410 | if (err == -EINTR) |
2411 | goto skip; | 2411 | goto skip; |