]> git.proxmox.com Git - mirror_ubuntu-artful-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)
committerStefan Bader <stefan.bader@canonical.com>
Wed, 14 Mar 2018 10:40:00 +0000 (11:40 +0100)
commit3fde705dae1cff4605eaef626f3da0ae480d5515
tree8a5ff088c794d59329839f8a4941792cc42a7e7f
parent651465ff85c119cb69f17f52b9ef4f72ac3228d9
netlink: fix netlink_ack() extack race

BugLink: http://bugs.launchpad.net/bugs/1744121
[ Upstream commit 48044eb490be71c203e14dd89e8bae87209eab52 ]

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/netlink/af_netlink.c