Ethernet Bridge development
 help / color / mirror / Atom feed
From: Nikolay Aleksandrov <razor@blackwall.org>
To: Ren Wei <enjou1224z@gmail.com>
Cc: bridge@lists.linux.dev, netdev@vger.kernel.org,
	idosch@nvidia.com, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, horms@kernel.org, nbd@nbd.name,
	linus.luessing@c0d3.blue, vega@nebusec.ai, zhilinz@nebusec.ai
Subject: Re: [PATCH net 1/1] net: bridge: stop fast-leave after deleting a port group
Date: Sun, 26 Jul 2026 13:13:53 +0300	[thread overview]
Message-ID: <amXd4UTdaREoxTpG@penguin> (raw)
In-Reply-To: <1cf0898872ef7c72d5f4c0304414a192c6dac591.1784707712.git.zhilinz@nebusec.ai>

On Fri, Jul 24, 2026 at 12:52:48AM +0800, Ren Wei wrote:
> From: Zhiling Zou <zhilinz@nebusec.ai>
> 
> br_multicast_leave_group() iterates mp->ports with pp = &p->next in
> its fast-leave path. After br_multicast_del_pg() removes p,
> continuing the loop advances pp through the deleted entry.
> 
> If multicast-to-unicast was enabled, the bridge can hold multiple port
> groups for the same port and group with different source MAC
> addresses. Once multicast-to-unicast is disabled,
> br_port_group_equal() matches those entries by port only. A fast leave
> can then delete one entry and continue from its stale next pointer,
> leaving mp->ports pointing at a deleted port group.
> 
> Fast leave only needs to remove one matching port group. Break after
> br_multicast_del_pg() so the loop stops before dereferencing the
> removed entry.
> 
> Fixes: 6db6f0eae605 ("bridge: multicast to unicast")
> Cc: stable@vger.kernel.org
> Reported-by: Vega <vega@nebusec.ai>
> Assisted-by: Codex:gpt-5.4
> Signed-off-by: Zhiling Zou <zhilinz@nebusec.ai>
> Signed-off-by: Ren Wei <enjou1224z@gmail.com>
> ---
>  net/bridge/br_multicast.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
> index 6b3ac473fd22..00aa9b2879d6 100644
> --- a/net/bridge/br_multicast.c
> +++ b/net/bridge/br_multicast.c
> @@ -3687,6 +3687,7 @@ br_multicast_leave_group(struct net_bridge_mcast *brmctx,
>  
>  			p->flags |= MDB_PG_FLAGS_FAST_LEAVE;
>  			br_multicast_del_pg(mp, p, pp);
> +			break;
>  		}
>  		goto out;
>  	}
> -- 
> 2.43.0
> 

Yeah, all other places which use br_port_group_equal do exactly that
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>


  reply	other threads:[~2026-07-26 10:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-23 16:52 [PATCH net 0/1] net: bridge: fix fast-leave use-after-free Ren Wei
2026-07-23 16:52 ` [PATCH net 1/1] net: bridge: stop fast-leave after deleting a port group Ren Wei
2026-07-26 10:13   ` Nikolay Aleksandrov [this message]
2026-07-27 22:40 ` [PATCH net 0/1] net: bridge: fix fast-leave use-after-free 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=amXd4UTdaREoxTpG@penguin \
    --to=razor@blackwall.org \
    --cc=bridge@lists.linux.dev \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=enjou1224z@gmail.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=linus.luessing@c0d3.blue \
    --cc=nbd@nbd.name \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=vega@nebusec.ai \
    --cc=zhilinz@nebusec.ai \
    /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