diff options
author | Nikolay Aleksandrov <nikolay@cumulusnetworks.com> | 2019-04-11 15:08:25 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-11 11:13:51 -0700 |
commit | c5b493ce192bd7a4e7bd073b5685aad121eeef82 (patch) | |
tree | 8681dcc4d5fb2a31d72d5c3a5f3f5ba9b8a8a757 | |
parent | 9a4dda81f1d377ff98e82f019e07a6f2a1db34f3 (diff) | |
download | linux-c5b493ce192bd7a4e7bd073b5685aad121eeef82.tar.gz linux-c5b493ce192bd7a4e7bd073b5685aad121eeef82.tar.bz2 linux-c5b493ce192bd7a4e7bd073b5685aad121eeef82.zip |
net: bridge: multicast: use rcu to access port list from br_multicast_start_querier
br_multicast_start_querier() walks over the port list but it can be
called from a timer with only multicast_lock held which doesn't protect
the port list, so use RCU to walk over it.
Fixes: c83b8fab06fc ("bridge: Restart queries when last querier expires")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_multicast.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c index 02da21d771c9..45e7f4173bba 100644 --- a/net/bridge/br_multicast.c +++ b/net/bridge/br_multicast.c @@ -2031,7 +2031,8 @@ static void br_multicast_start_querier(struct net_bridge *br, __br_multicast_open(br, query); - list_for_each_entry(port, &br->port_list, list) { + rcu_read_lock(); + list_for_each_entry_rcu(port, &br->port_list, list) { if (port->state == BR_STATE_DISABLED || port->state == BR_STATE_BLOCKING) continue; @@ -2043,6 +2044,7 @@ static void br_multicast_start_querier(struct net_bridge *br, br_multicast_enable(&port->ip6_own_query); #endif } + rcu_read_unlock(); } int br_multicast_toggle(struct net_bridge *br, unsigned long val) |