]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net: bridge: multicast: use rcu to access port list from br_multicast_start_querier
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Thu, 11 Apr 2019 12:08:25 +0000 (15:08 +0300)
committerDavid S. Miller <davem@davemloft.net>
Thu, 11 Apr 2019 18:13:51 +0000 (11:13 -0700)
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: 3497905d97b5 ("bridge: Restart queries when last querier expires")
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_multicast.c

index 02da21d771c9cc7d93c442f0310ad2ab5d9b66f6..45e7f4173bbafe7e59e2ea514a7bccbee8456c79 100644 (file)
@@ -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)