]> rtime.felk.cvut.cz Git - sojka/nv-tegra/linux-3.10.git/commit
bridge: fix br_stp_set_bridge_priority race conditions
authorNikolay Aleksandrov <razor@blackwall.org>
Mon, 15 Jun 2015 17:28:51 +0000 (20:28 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jul 2015 17:40:20 +0000 (10:40 -0700)
commit019b1332afd4dc4c80fa83379866d01984933694
tree935306864954188f83ac351da5781451380903a7
parent80cbc4a31be6abe812cdbd81d4b98e4d7771c7fa
bridge: fix br_stp_set_bridge_priority race conditions

[ Upstream commit 2dab80a8b486f02222a69daca6859519e05781d9 ]

After the ->set() spinlocks were removed br_stp_set_bridge_priority
was left running without any protection when used via sysfs. It can
race with port add/del and could result in use-after-free cases and
corrupted lists. Tested by running port add/del in a loop with stp
enabled while setting priority in a loop, crashes are easily
reproducible.
The spinlocks around sysfs ->set() were removed in commit:
14f98f258f19 ("bridge: range check STP parameters")
There's also a race condition in the netlink priority support that is
fixed by this change, but it was introduced recently and the fixes tag
covers it, just in case it's needed the commit is:
af615762e972 ("bridge: add ageing_time, stp_state, priority over netlink")

Signed-off-by: Nikolay Aleksandrov <razor@blackwall.org>
Fixes: 14f98f258f19 ("bridge: range check STP parameters")
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/bridge/br_ioctl.c
net/bridge/br_stp_if.c