netlink: reset extack earlier in netlink_rcv_skb
authorXin Long <lucien.xin@gmail.com>
Thu, 18 Jan 2018 06:48:03 +0000 (14:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 31 Jan 2018 13:03:48 +0000 (14:03 +0100)
commit48606bb1eef7c46f154cb4a6c5509729e60a4e91
tree77bd9b5f4fc0de8d2440062de4646eded033109c
parenta8c21ba721d4bfc614ecb46f9507cc042b6a6d6b
netlink: reset extack earlier in netlink_rcv_skb

[ Upstream commit cd443f1e91ca600a092e780e8250cd6a2954b763 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/netlink/af_netlink.c