Skip to content

Commit

Permalink
bridge: Fix potential deadlock on br->multicast_lock
Browse files Browse the repository at this point in the history
multicast_lock is taken in softirq context, so we should use
spin_lock_bh() in userspace.

call-chain in softirq context:
run_timer_softirq()
	br_multicast_query_expired()

call-chain in userspace:
sysfs_write_file()
	store_multicast_snooping()
		br_multicast_toggle()

Signed-off-by: Andrew Vagin <avagin@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Andrey Vagin authored and David S. Miller committed Nov 14, 2011
1 parent 731abb9 commit ef5e0d8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/bridge/br_multicast.c
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
int err = 0;
struct net_bridge_mdb_htable *mdb;

spin_lock(&br->multicast_lock);
spin_lock_bh(&br->multicast_lock);
if (br->multicast_disabled == !val)
goto unlock;

Expand Down Expand Up @@ -1806,7 +1806,7 @@ int br_multicast_toggle(struct net_bridge *br, unsigned long val)
}

unlock:
spin_unlock(&br->multicast_lock);
spin_unlock_bh(&br->multicast_lock);

return err;
}
Expand Down

0 comments on commit ef5e0d8

Please sign in to comment.