From: Ido Schimmel <idosch@nvidia.com>
To: xiaoblac <teel4res@gmail.com>
Cc: Nikolay Aleksandrov <razor@blackwall.org>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Horatiu Vultur <horatiu.vultur@microchip.com>,
bridge@lists.linux.dev, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v3] net: bridge: disable MRP ports before the FDB flush in del_nbp()
Date: Mon, 2 Nov 2026 10:32:16 +0200 [thread overview]
Message-ID: <20261102083216.GA794532@shredder> (raw)
In-Reply-To: <20261102082553.GB778610@shredder>
On Mon, Nov 02, 2026 at 10:25:53AM +0200, Ido Schimmel wrote:
> On Sat, Oct 31, 2026 at 09:48:40PM -0700, xiaoblac wrote:
> > From: Cheng Yongkang <teel4res@gmail.com>
> >
> > del_nbp() flushes the port's FDB entries before it unregisters the RX
> > handler. For a normal port, br_stp_disable_port() moves the port to
> > BR_STATE_DISABLED before this cleanup.
> >
> > That does not hold for an MRP ring port. br_set_state() ignores state
> > changes while BR_MRP_AWARE_BIT is set, so br_stp_disable_port() leaves
> > the port state alone. br_mrp_port_del() then restores forwarding when
> > the bridge is up before clearing the bit. A frame received between
> > br_fdb_cleanup_by_dst() and netdev_rx_handler_unregister() can therefore
> > create a new FDB entry referencing the dying port. Nothing removes that
> > entry before destroy_nbp_rcu() frees the port, so a later frame to the
> > learned MAC can be forwarded through the freed port.
> >
> > Remove the MRP and CFM instances before disabling the port, so that
> > br_stp_disable_port() actually transitions it to BR_STATE_DISABLED.
> > With CONFIG_BRIDGE_VLAN_FILTERING=y, synchronize_net() in
> > nbp_vlan_group_unpublish() also drains receive paths that could still
> > learn with the old state before the final FDB cleanup.
> >
> > Found through an LLM-assisted source code analysis workflow and
> > reproduced on net with KASAN and CONFIG_BRIDGE_VLAN_FILTERING=y in QEMU.
> > A diagnostic switchdev module accepts MRP objects and delays the
> > NETDEV_CHANGEUPPER callback for 1.5 s, holding del_nbp() after the FDB
> > cleanup and before RX handler removal. The reproducer floods the MRP
> > port with rotating source MACs, waits for the port's RCU callback
> > through the module's rcu_barrier(), then sends frames to those MACs
> > from another port. The unpatched kernel reports:
> >
> > BUG: KASAN: slab-use-after-free in br_forward+0xb1/0x820
> > Call Trace:
> > <IRQ>
> > br_forward+0xb1/0x820
> > br_handle_frame_finish+0x148b/0x1e50
> > br_handle_frame+0x90a/0x15c0
> >
> > With this patch, three runs of six cycles each reach the delay without
> > a KASAN report.
> >
> > Fixes: 6536993371fa ("bridge: mrp: Integrate MRP into the bridge")
> > Suggested-by: Ido Schimmel <idosch@nvidia.com>
> > Link: https://lore.kernel.org/netdev/20261012123051.GA714215@shredder/
> > Closes: https://lore.kernel.org/netdev/20261022090431.3641707-1-teel4res@gmail.com/
> > Signed-off-by: Cheng Yongkang <teel4res@gmail.com>
>
> Reviewed-by: Ido Schimmel <idosch@nvidia.com>
I replied to Sashiko before tagging this patch, but looks like the mail
didn't make it to the list. The two issues that it flagged are separate
pre-existing issues. The current patch fixes a UAF and doesn't make the
situation worse.
prev parent reply other threads:[~2026-11-02 8:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-01 4:48 [PATCH net v3] net: bridge: disable MRP ports before the FDB flush in del_nbp() xiaoblac
2026-11-02 4:50 ` netdev-bot+sashiko
2026-11-02 8:25 ` Ido Schimmel
2026-11-02 8:32 ` Ido Schimmel [this message]
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=20261102083216.GA794532@shredder \
--to=idosch@nvidia.com \
--cc=bridge@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horatiu.vultur@microchip.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=razor@blackwall.org \
--cc=teel4res@gmail.com \
/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