From: Nikolay Aleksandrov <razor@blackwall.org>
To: netdev@vger.kernel.org
Cc: bridge@lists.linux-foundation.org,
Nikolay Aleksandrov <nikolay@nvidia.com>,
stable@vger.kernel.org, roopa@nvidia.com
Subject: [Bridge] [PATCH net 1/2] net: bridge: multicast: fix PIM hello router port marking race
Date: Sun, 11 Jul 2021 12:56:28 +0300 [thread overview]
Message-ID: <20210711095629.2986949-2-razor@blackwall.org> (raw)
In-Reply-To: <20210711095629.2986949-1-razor@blackwall.org>
From: Nikolay Aleksandrov <nikolay@nvidia.com>
When a PIM hello packet is received on a bridge port with multicast
snooping enabled, we mark it as a router port automatically, that
includes adding that port the router port list. The multicast lock
protects that list, but it is not acquired in the PIM message case
leading to a race condition, we need to take it to fix the race.
Cc: stable@vger.kernel.org
Fixes: 91b02d3d133b ("bridge: mcast: add router port on PIM hello message")
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
---
net/bridge/br_multicast.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index 53c3a9d80d9c..3bbbc6d7b7c3 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -3264,7 +3264,9 @@ static void br_multicast_pim(struct net_bridge *br,
pim_hdr_type(pimhdr) != PIM_TYPE_HELLO)
return;
+ spin_lock(&br->multicast_lock);
br_ip4_multicast_mark_router(br, port);
+ spin_unlock(&br->multicast_lock);
}
static int br_ip4_multicast_mrd_rcv(struct net_bridge *br,
--
2.31.1
next prev parent reply other threads:[~2021-07-11 9:56 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-11 9:56 [Bridge] [PATCH net 0/2] net: bridge: multicast: fix automatic router port marking races Nikolay Aleksandrov
2021-07-11 9:56 ` Nikolay Aleksandrov [this message]
2021-07-11 9:56 ` [Bridge] [PATCH net 2/2] net: bridge: multicast: fix MRD advertisement router port marking race Nikolay Aleksandrov
2021-07-12 17:50 ` [Bridge] [PATCH net 0/2] net: bridge: multicast: fix automatic router port marking races patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210711095629.2986949-2-razor@blackwall.org \
--to=razor@blackwall.org \
--cc=bridge@lists.linux-foundation.org \
--cc=netdev@vger.kernel.org \
--cc=nikolay@nvidia.com \
--cc=roopa@nvidia.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox