]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
netlink: fix netlink_ack() extack race
authorJohannes Berg <johannes.berg@intel.com>
Mon, 16 Oct 2017 15:09:53 +0000 (17:09 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 18 Oct 2017 11:22:28 +0000 (12:22 +0100)
commit48044eb490be71c203e14dd89e8bae87209eab52
treed3f0d375ba4de0aa909875f66eff5bbde5d00984
parent2de09681e4ce8b1caa79d2e4482b72d8ef41c550
netlink: fix netlink_ack() extack race

It seems that it's possible to toggle NETLINK_F_EXT_ACK
through setsockopt() while another thread/CPU is building
a message inside netlink_ack(), which could then trigger
the WARN_ON()s I added since if it goes from being turned
off to being turned on between allocating and filling the
message, the skb could end up being too small.

Avoid this whole situation by storing the value of this
flag in a separate variable and using that throughout the
function instead.

Fixes: 2d4bc93368f5 ("netlink: extended ACK reporting")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c