Skip to content

Commit 000b728

Browse files
Nikolay Aleksandrovdavem330
authored andcommitted
net: bridge: multicast: fix MRD advertisement router port marking race
When an MRD advertisement is received on a bridge port with multicast snooping enabled, we mark it as a router port automatically, that includes adding that port to the router port list. The multicast lock protects that list, but it is not acquired in the MRD advertisement case leading to a race condition, we need to take it to fix the race. Cc: [email protected] Cc: [email protected] Fixes: 4b3087c ("bridge: Snoop Multicast Router Advertisements") Signed-off-by: Nikolay Aleksandrov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 04bef83 commit 000b728

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

net/bridge/br_multicast.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3277,7 +3277,9 @@ static int br_ip4_multicast_mrd_rcv(struct net_bridge *br,
32773277
igmp_hdr(skb)->type != IGMP_MRDISC_ADV)
32783278
return -ENOMSG;
32793279

3280+
spin_lock(&br->multicast_lock);
32803281
br_ip4_multicast_mark_router(br, port);
3282+
spin_unlock(&br->multicast_lock);
32813283

32823284
return 0;
32833285
}
@@ -3345,7 +3347,9 @@ static void br_ip6_multicast_mrd_rcv(struct net_bridge *br,
33453347
if (icmp6_hdr(skb)->icmp6_type != ICMPV6_MRDISC_ADV)
33463348
return;
33473349

3350+
spin_lock(&br->multicast_lock);
33483351
br_ip6_multicast_mark_router(br, port);
3352+
spin_unlock(&br->multicast_lock);
33493353
}
33503354

33513355
static int br_multicast_ipv6_rcv(struct net_bridge *br,

0 commit comments

Comments
 (0)