From: Nikolay Aleksandrov <razor@blackwall.org>
To: Fourie Zhang <littleddfu@gmail.com>, netdev@vger.kernel.org
Cc: TencentOS Corvus AI <corvus@tencent.com>,
stable@vger.kernel.org, Ido Schimmel <idosch@nvidia.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Petr Machata <petrm@nvidia.com>,
bridge@lists.linux.dev
Subject: Re: [PATCH net] net: bridge: mdb: restart port group walk after deletion
Date: Mon, 21 Sep 2026 17:14:35 +0300 [thread overview]
Message-ID: <ab670ef7-7650-4a39-9871-b5182725beb1@blackwall.org> (raw)
In-Reply-To: <20260920110852.60293-1-fouriezhang@tencent.com>
On 20/09/2026 14:08, Fourie Zhang wrote:
> br_mdb_flush_pgs() keeps a pointer-to-pointer cursor while walking
> mp->ports. br_multicast_del_pg() can re-enter the same MDB entry through
> br_multicast_sg_del_exclude_ports() and unlink other port groups. If the
> cursor points into one of those groups, the next iteration dereferences a
> stale cursor and can leave mp->ports pointing at freed memory.
>
> A following RTM_GETMDB exposes the dangling pointer:
>
> BUG: KASAN: slab-use-after-free in br_mdb_dump
> Read of size 8
> br_mdb_dump
> rtnl_mdb_dump
> rtnl_dumpit
> netlink_dump
>
> Reset the cursor to mp->ports after every deletion. The deletion removes at
> least the selected group, so the restarted walk always makes progress.
>
> Fixes: a6acb535afb2 ("bridge: mdb: Add MDB bulk deletion support")
> Cc: stable@vger.kernel.org
> Assisted-by: tencentos-corvus-ai:hy4-preview
> Signed-off-by: Fourie Zhang <fouriezhang@tencent.com>
> ---
> A reproducer for this issue is available if requested.
>
> net/bridge/br_mdb.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
> index e0c7020b1..a01bd280c 100644
> --- a/net/bridge/br_mdb.c
> +++ b/net/bridge/br_mdb.c
> @@ -1523,6 +1523,8 @@ static void br_mdb_flush_pgs(struct net_bridge *br,
> }
>
> br_multicast_del_pg(mp, p, pp);
> + /* br_multicast_del_pg() can remove other groups from this list. */
> + pp = &mp->ports;
> }
> }
>
Yeah, this seems like the simplest fix for stable. I will post my conversion to
standard list primitives and will remove these issues altogether with it in
net-next.
Acked-by: Nikolay Aleksandrov <razor@blackwall.org>
next prev parent reply other threads:[~2026-09-21 14:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-20 11:08 [PATCH net] net: bridge: mdb: restart port group walk after deletion Fourie Zhang
2026-09-21 14:14 ` Nikolay Aleksandrov [this message]
2026-09-24 0:00 ` 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=ab670ef7-7650-4a39-9871-b5182725beb1@blackwall.org \
--to=razor@blackwall.org \
--cc=bridge@lists.linux.dev \
--cc=corvus@tencent.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=idosch@nvidia.com \
--cc=kuba@kernel.org \
--cc=littleddfu@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=petrm@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