bridge: fix RCU races with bridge port
The macro br_port_exists() is not enough protection when only RCU is being used. There is a tiny race where other CPU has cleared port handler hook, but is bridge port flag might still be set. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
61391cde9e
commit
b5ed54e94d
@@ -141,10 +141,6 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
|
||||
struct net_bridge *br;
|
||||
const unsigned char *buf;
|
||||
|
||||
if (!br_port_exists(dev))
|
||||
goto err;
|
||||
p = br_port_get_rcu(dev);
|
||||
|
||||
if (!pskb_may_pull(skb, 4))
|
||||
goto err;
|
||||
|
||||
@@ -153,6 +149,10 @@ void br_stp_rcv(const struct stp_proto *proto, struct sk_buff *skb,
|
||||
if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0)
|
||||
goto err;
|
||||
|
||||
p = br_port_get_rcu(dev);
|
||||
if (!p)
|
||||
goto err;
|
||||
|
||||
br = p->br;
|
||||
spin_lock(&br->lock);
|
||||
|
||||
|
Reference in New Issue
Block a user