Skip to content

Commit 83f6a74

Browse files
stephen hemmingerdavem330
authored andcommitted
bridge: multicast port group RCU fix
The recently introduced bridge mulitcast port group list was only partially using RCU correctly. It was missing rcu_dereference() and missing the necessary barrier on deletion. The code should have used one of the standard list methods (list or hlist) instead of open coding a RCU based link list. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 168d40e commit 83f6a74

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎net/bridge/br_forward.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ static void br_multicast_flood(struct net_bridge_mdb_entry *mdst,
217217
prev = NULL;
218218

219219
rp = rcu_dereference(br->router_list.first);
220-
p = mdst ? mdst->ports : NULL;
220+
p = mdst ? rcu_dereference(mdst->ports) : NULL;
221221
while (p || rp) {
222222
lport = p ? p->port : NULL;
223223
rport = rp ? hlist_entry(rp, struct net_bridge_port, rlist) :
@@ -231,7 +231,7 @@ static void br_multicast_flood(struct net_bridge_mdb_entry *mdst,
231231
goto out;
232232

233233
if ((unsigned long)lport >= (unsigned long)port)
234-
p = p->next;
234+
p = rcu_dereference(p->next);
235235
if ((unsigned long)rport >= (unsigned long)port)
236236
rp = rcu_dereference(rp->next);
237237
}

‎net/bridge/br_multicast.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static void br_multicast_del_pg(struct net_bridge *br,
259259
if (p != pg)
260260
continue;
261261

262-
*pp = p->next;
262+
rcu_assign_pointer(*pp, p->next);
263263
hlist_del_init(&p->mglist);
264264
del_timer(&p->timer);
265265
del_timer(&p->query_timer);

0 commit comments

Comments
 (0)