๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #6374

Re: [BUG] net: bridge: late FDB learning can outlive an MRP port

#6374
From: Eric Dumazet
Date: Thu, 22 Oct 2026 09:27
66 lines
11264 bytes
Le jeu. 22 oct. 2026 ร  11:04, Cheng Yongkang <teel4res@gmail.com> a รฉcrit :
>
> Hi all,
>
> An MRP-aware bridge port can remain in BR_STATE_FORWARDING during
> del_nbp().  The terminal br_fdb_delete_by_port() runs before
> netdev_rx_handler_unregister(), so a frame received in that window can
> learn a new FDB entry whose dst is the port being deleted.  No second
> FDB sweep follows.  The port is then RCU-freed, leaving the FDB entry
> with a stale net_bridge_port pointer.
>
> Observed on Linux v7.3, commit
> 08ab31164c55f20c7a2653de3186ae333470e2c1, with KASAN+UBSAN:
>
>   BUG: KASAN: slab-use-after-free in br_forward+0x55/0x3c0
>   Read of size 8
>     br_forward
>     br_handle_frame_finish
>     br_handle_frame
>   Allocated by:
>     new_nbp
>     br_add_if
>   Freed by:
>     kfree
>     kobject_put
>     rcu_core
>
> The failing sequence is:
>
>   br_stp_disable_port() leaves the MRP-aware port forwarding
>   br_mrp_del_impl() restores BR_STATE_FORWARDING
>   br_fdb_delete_by_port()
>   ... late ingress frame learns fdb->dst == p ...
>   netdev_rx_handler_unregister()
>   call_rcu(&p->rcu, destroy_nbp_rcu)
>   later frame -> br_forward(stale dst)
>
> This reproduced in three independent VM boots.  The target bridge code
> was unchanged.  Because the test VM has no driver that accepts
> SWITCHDEV_OBJ_ID_MRP, a small diagnostic switchdev endpoint claimed the
> MRP object and widened the already-existing post-FDB-flush/pre-unregister
> window.  It did not replace bridge logic, modify FDB entries, or alter
> net_bridge_port lifetime.
>
> The deletion path should stop new RX processing before the final FDB
> sweep, or drain the deferred/FDB state after the RX handler is
> unregistered and before queueing the port for RCU free.
>
> I found no matching upstream fix.  Candidate BR-007, BR-040 and BR-058
> are consequences of this same root cause.  BR-040 gives the forwarding
> window; BR-058 independently describes the stale-FDB lifetime.
>
> The reproducer, module source, and complete serial logs are available
> on request.
>
> This was found with AI-assisted source analysis and fuzzing; the kernel
> behavior above was reproduced under KASAN.
>
> Thanks,
> Cheng Yongkang

I suggest you stop sending these emails, we all have LLM you know.

What is the point, if you do not send patches?
Technical Details
Message-ID: <CAL4Wiip9-oGNjrgQV-VSkDR_hfq35d_+ymX_itYk29u9scY=Mg@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350476-linux-kernel-netdev=dewy.ru
References: <20261022090431.3641707-1-teel4res@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350476-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [BUG] net: bridge: late FDB learning can outlive an MRP port
Date: Thu, 22 Oct 2026 11:27:57 +0200
Organization: Usenet Network
Message-ID: <CAL4Wiip9-oGNjrgQV-VSkDR_hfq35d_+ymX_itYk29u9scY=Mg@mail.gmail.com>
References: <20261022090431.3641707-1-teel4res@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
	logging-data="178881"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:VZJYsfbn0TlNqUnJjssoDyfLxFo= sha256:OvqhQTjEmaZuFhsyWLD3pEBJ6eNWmZjSt7t1B+4L5fA=
	sha1:f2ZZaFXoK/w8+8MiE8jOwjUn0Go= sha256:tmkX0eYQLevUgyCVYRxIz2xx9LdsfXm7cfnG4uhqd4s=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 25FF4111214; Thu, 22 Oct 2026 12:42:17 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id E8_RFeQUgBdL;
	Thu, 22 Oct 2026 12:42:15 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350476-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id D1470111217; Thu, 22 Oct 2026 12:42:05 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 8D1636017F; Thu, 22 Oct 2026 09:28:23 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1792661301;
	b=SXNkJIdHYdEbhCJtYtoVAWZI6YsrEDGC8wvZwnL627dakxUISszpbDJUpsd4vGAt5Gkp
	 AND/D1EJDypXJm+MRGfgop7nrxbsAeOhCBaN+IftMFId6XQAm0m6mcLMw8MqoGgURZNgD
	 dtdv7cVdL/OG5EBaV0v5AmfZ59qDrX6Uv85uI36J80MgJScM4C9dzI2WZ4XmCsinPRQ7G
	 u1/cap9JDqICEsIF5uNdX/epgjr52KbGBiA6GFqYfNPLeJqvsVBZ/xtndk5pBRWcXkW6k
	 Y7YWn8dc9rGT9Wb/Bbw5HKgTJqoKXTLPmWN7VdLaTn3jXDngQ3m1ym3mKsMftTj/4Jg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792661301;
	h=X-Original-To:Received:Received:DKIM-Signature:Received:
	 X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
	 X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
	 Content-Type:Content-Transfer-Encoding;
	bh=b16AqzWrmx6PCjjmVkdtVIc26QQOCuhEY/Lbc4sfw0A=;
	b=P+6xVOkwGSZ2cF2eTcJrC6GZzBitmn1WwF6Bvc8dLpBR7PilOMApuVtEVByFuzGyzgFd
	 pmOLEbI9ig/EJMafsUNzCuYREq5Q4dPKjyhXsaEn5BuEbxHt9fnf+m7pG1GjifYZHLCUH
	 4CcamTeIgqUYze2RfKFAk/uU4lxzpgtBsPRPDVPuHIKiGvmZh4nJaCn2yC1xSpL8RdQrU
	 0L1A+R8PcgRYndFhTuFwn6S9NFbkK8QZUy9NmrpziXqw0GRMg70glBxT0KUiENkOlBR+I
	 SAbgNYvemKg50Jr8SpTwdBdffga+z83QUiSVqfkWyLivp/yNI6W45hFu1QE5XpCfP9Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dTGPpB2y;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 58918606A320;
	Thu, 22 Oct 2026 09:28:21 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dTGPpB2y
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1792661290;
	b=bhJx1EkeGvz5bAWMjSoGWTCDCwMn+eAm5v2SjPCwwu7Z/tQTnMWIYssScei9GQT2T9oN
	 z0ThXgFyB0ZGLy8UlzXkM4zAAnp3oOzHy291ecwRmiKKZFBzv5u3rY3W6LY2PgFEQIzJ6
	 QWTCsAbhCW2lC6kPtanUZCKUYQ9yH05JhtBgwSCCdMtTKrPPnGSl6o9LWzolwmcdq7N0L
	 OLaHaCfeYfHUZloC7q61M7okGF0gbI0q//ci7KaUCmOkAhGZtyfbRJUHQvIe7jKP3xQgS
	 qP9BnpCLFBRo6Gmik7SZj4u8EKf3WL4HtPCemVefnQNyX+mQfICjT/sjW1aDtiKsEYA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1792661290;
	h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
	 X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
	 From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
	 Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
	bh=b16AqzWrmx6PCjjmVkdtVIc26QQOCuhEY/Lbc4sfw0A=;
	b=5tB+qpMqT6dNqlN/QFmK/hE43L5VIZK0ErlajBai7oz0BUVHla1PLjMPHbSWElYtJPcg
	 GaUqcRVo/3jh/VNSos/xhANryPnn7LCIlUc+drd1SCs3G15TURZ0djcU5zHdejgCNe5e9
	 7H/2bS7i7eQrNK4/8TRS2f3aOmKdqKyqW0k06U/kJOy9C0zzu1Tl5lIf9w/+clxDRB3Ls
	 IUZUH0Ye/DJ2WGsX0QMr/UNE/8jAYdeSOZNZ5fY8ESkqZI6e1ZD99rDQQWO3xdeaTNQHi
	 cISVV6Z5SrblZThqcBUZmZ+AArZ2t/rH0or25YU1FK7v0eOuITa8AgjyjpvYZUp4Lbg==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=dTGPpB2y;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3B1EC606A324
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 09:28:10 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2A891F000C2
	for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 09:28:09 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1792661290;
	bh=b16AqzWrmx6PCjjmVkdtVIc26QQOCuhEY/Lbc4sfw0A=;
	h=References:In-Reply-To:From:Date:Subject:To:Cc;
	b=dTGPpB2yuOtIRTiVRcSqefJbTmZDIzw2DXMa/Te82wylzlryq+uHX6Dw6UGlNUrB1
	 o2k8VB0bGsLf1c0WpRuCEv50CCKqa64IEkYw3RpQ3IA1mAuqnrN0VYZjpytvK/sxor
	 C5zVoJd4M48lVV48WCX8f5wBSeo5rk878wPUYGsYqEeINlKaFGKLv9O9J31OcrTcLE
	 GqUm6YAESSVuRG+WY6SWKQTaFztUbMNq5TcJvfaRghhk+aTgd8aBWIjtxt45MHteEw
	 nSiRN2EO8tcaDwR8XqvwM63yZOUT83MS5xZZUL8yRHeHI9e2H1p4dkibZ8siY18+ql
	 cmjnbDaMgXifQ==
X-Received: by mail-oa1-f54.google.com with SMTP id 586e51a60fabf-48e2d5a69c4so846021fac.3
        for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 02:28:09 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBy62a9cPaTUNJyaWe1HjJU6nq9CM6PWZsxUZTkzHv/IYlP/OajFXMwJgw6/sXN+ofgOW1xIJqo=@vger.kernel.org
X-Gm-Message-State: AFq9FYKesgot8+ClHWWYSOWGEfDv+8y9LK44hqmTVLCjbmFNMrJMsJjo
	kgaINOTeKv/e6e9wYoDnKmLrUSvE0sW2eJvGTglLaeqYKlWAUh0E87bTpb2m596WAuKSaQEe1iD
	ZCcfRjvZr/NHESP0kXS34DMWCzGMsTLU=
X-Received: by 2002:a05:6871:6681:b0:49d:c3f6:4191 with SMTP id
 586e51a60fabf-4a7dc15cb9emr2583880fac.18.1792661289186; Thu, 22 Oct 2026
 02:28:09 -0700 (PDT)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261022090431.3641707-1-teel4res@gmail.com>
X-Gmail-Original-Message-ID: <CAL4Wiip9-oGNjrgQV-VSkDR_hfq35d_+ymX_itYk29u9scY=Mg@mail.gmail.com>
X-Gm-Features: AclHuK-mJUESD7RYwjo_wmXzNyLsWvwMRTYfXqXRI4IDUC_o01XXw1PdqN8O9Bg
X-Cc: Nikolay Aleksandrov <razor@blackwall.org>, Ido Schimmel <idosch@nvidia.com>, 
	"David S . Miller" <davem@davemloft.net>, Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>, 
	Simon Horman <horms@kernel.org>, bridge@lists.linux.dev, netdev@vger.kernel.org, 
	linux-kernel@vger.kernel.org