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:
stephen hemminger
2010-11-15 06:38:13 +00:00
committed by David S. Miller
parent 61391cde9e
commit b5ed54e94d
8 changed files with 44 additions and 34 deletions

View File

@ -475,11 +475,8 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
{
struct net_bridge_port *p;
if (!br_port_exists(dev))
return -EINVAL;
p = br_port_get(dev);
if (p->br != br)
if (!p || p->br != br)
return -EINVAL;
del_nbp(p);