🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #8542

[PATCH net v3 0/2] net: dsa: mxl862xx: bound FDB dump walk and validate BRIDGE_ALLOC ids

#8542
From: memoriaru
Date: Thu, 29 Oct 2026 11:25
70 lines
12538 bytes
From: Zhang Hewei <memoriaru@foxmail.com>

Hello,

v3 of the two mxl862xx robustness fixes, rebased onto the current
net tree as requested.

The v2 series did not apply because it still carried full copies of
mxl862xx-api.h and mxl862xx.h (the driver pre-dating the upstream
restructure into mxl862xx-host.c / mxl862xx-phylink.c). Both fixes
are now re-ported onto the restructured driver; no driver files are
created or renamed by this series anymore, the two patches only
touch drivers/net/dsa/mxl862xx/mxl862xx.c.

The bugs themselves are unchanged in the restructured code:
mxl862xx_port_fdb_dump() still walks the MAC table in a while(true)
loop whose only exit is the device-controlled "last" flag, and
mxl862xx_allocate_bridge() still returns the firmware-supplied
bridge id without validating it.

v1: https://lore.kernel.org/netdev/tencent_5A7AEC56CDB23A83120519D0C074B592C706@qq.com/
v2: https://lore.kernel.org/netdev/tencent_6030CC520C02054D1B2925AEEF6FA92DC30A@qq.com/

Changes since v2:
- rebase onto net (fa503935c2d6): re-ported the FDB dump read limit
  to the restructured mxl862xx_port_fdb_dump() (the while(true) +
  "last" exit is unchanged, the limit check and its comment moved
  verbatim); re-ported the BRIDGE_ALLOC validation to the
  restructured mxl862xx_allocate_bridge() (unchanged logic)
- dropped the mxl862xx-api.h / mxl862xx.h file creations that v2
  carried: both files exist upstream since the restructure, so the
  series is now two pure fixes to drivers/net/dsa/mxl862xx/mxl862xx.c

Changes since v1:
- the walk limit is now checked after the "last" test: the walk
  needs one read more than the number of entries it reports, so
  checking before it rejected a correctly ended walk of a full table
- macro name, error message and comments say "conservative read
  limit" instead of "table capacity", which the exact value is not
- the "growing kernel memory without bound" wording is gone:
  entries whose port id does not match never reach the callback,
  which is exactly why the walk needs its own bound (the netlink
  dump skb never fills)
- BRIDGE_ALLOC validation now also rejects 0xffff (INVALID_HANDLE is
  documented but never defined; the MaxLinear GSW API uses 0xffff)
  and ids already in use, closing the duplicate-FID collapse
- Fixes: tags added (both issues come from the bridge offloading
  commit), self Reported-by trailers dropped

Base-commit: fa503935c2d6603856dafff0a0852631ab6e9503

Cc: Daniel Golle <daniel@makrotopia.org> (driver author)
Cc: Andrew Lunn <andrew@lunn.ch>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: Vladimir Oltean <olteanv@gmail.com>
Cc: Johan Hovold <johan@kernel.org>
Cc: Jakub Kicinski <kuba@kernel.org>
Cc: Paolo Abeni <pabeni@redhat.com>
Cc: netdev@vger.kernel.org

Zhang Hewei (2):
  net: dsa: mxl862xx: bound FDB dump walk with a read limit
  net: dsa: mxl862xx: validate the bridge id returned by BRIDGE_ALLOC

 drivers/net/dsa/mxl862xx/mxl862xx.c | 59 ++++++++++++++++++++++++++---
 1 file changed, 56 insertions(+), 3 deletions(-)

-- 
2.39.5 (Apple Git-154)
Technical Details
Message-ID: <tencent_E2490A092089691125F9F5922DA065778607@qq.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-353264-linux-kernel-netdev=dewy.ru
References: <tencent_6030CC520C02054D1B2925AEEF6FA92DC30A@qq.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-353264-linux-kernel-netdev=dewy.ru
From: memoriaru@foxmail.com
Newsgroups: linux.kernel.netdev
Subject: [PATCH net v3 0/2] net: dsa: mxl862xx: bound FDB dump walk and validate BRIDGE_ALLOC ids
Date: Thu, 29 Oct 2026 19:25:26 +0800
Organization: Usenet Network
Message-ID: <tencent_E2490A092089691125F9F5922DA065778607@qq.com>
References: <tencent_6030CC520C02054D1B2925AEEF6FA92DC30A@qq.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="1995963"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:GoK5DcvcZBhuSrOEp/h/ChXXZrI= sha256:RGZin9uub6guRm1p1gAlZvalAmpczYkY/BnKwxq/vFQ=
	sha1:kiNsAw2Rk/XEtur6EpBGahGwksI= sha256:2PmkDBxCrzfmHBXX5vNjbSdlDQsY2yzYTOyaDZ/cHsw=
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 47787125C65; Thu, 29 Oct 2026 14:26:25 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25,
	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 (1024-bit key)
	header.d=foxmail.com
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 VnsQB2J4srsl;
	Thu, 29 Oct 2026 14:26:21 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-353264-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=foxmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 8528B125C63; Thu, 29 Oct 2026 14:26:11 +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 C5EE2269E9; Thu, 29 Oct 2026 11:25:46 +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=1793273146;
	b=ZC7whixgXVbZ7plgAvYEDHVIi+dA3ZGGf+7OD7XHoHeaoCXtAA5LGIjo2EvkxY/X/C/g
	 LzaJke95XnsY3iwMr3Q6lJWyoc5gGzcdpNDDy9BnfV3tvnC+y12ppNRG/JTigiUeypCK7
	 MnlemLi0I3JWmVb31aZGguli7xVCYyIDqF7wnweueVxe4GjZumdb5c52JvOGkW8JCbsBu
	 mWMi8chjphs4+9JG6JMqCb3HgSyWAZppZlP1Hn3gSRrtyRQ0bzA09iRRzvbCLhSXK7wgT
	 hkecButCo4O787S63/Ti180d1Bju9/Kbnajv50EngG7v1yJFtEEGUZ5KPha3tUq7inA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793273146;
	h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:X-QQ-mid:
	 Message-ID:X-QQ-XMAILINFO:X-QQ-XMRINFO:From:To:Cc:Subject:Date:
	 X-OQ-MSGID:X-Mailer:In-Reply-To:References:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=Rlc0Qn2G92bUMErWlek3q+ofs6Y3b5n85QGfapsmbas=;
	b=3XcTXwVFC3tcKryW1+ppBv2act1vnPGLCxBy0oIQprzTkRUx8K41wO1TtDs77niepSzB
	 Cn0CsCAXY2v2v7N6mEMRCqRwi2miR4yC8CwApj7qPIKPs2zMLrms41VTefCnaJMxW1hyO
	 hw/DSxElyjUiQU/qmd373qqC6XdjJrxX78taeLZmRKFsNkS9kdKX1lqKPDcA7Bp/wunI6
	 VkxTD3l+kGEc2Ypv8VF1eWByjFrydcugCo+vNemUJ2HbXnFWPTN23mkHxR1NNIFHQU9/P
	 x0WJrzbfpO/mjNQpf94A+ZgXjSREcYwsKlRpNSiipOaLkTqtpAuvgOT5lrfPgOCbMgQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=gFGWSDAX;
	dmarc=pass header.from=foxmail.com;
	spf=pass smtp.mailfrom=foxmail.com;
	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 51188606A329;
	Thu, 29 Oct 2026 11:25:46 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (1024-bit key, unprotected) header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=gFGWSDAX
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=162.62.58.216
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793273145;
	b=FxxpQNtdyIXXI/grHq5NMrAJ+BOho0Pq2leKBreCePwnYqbbsdjBXT2jYDhTNslQTkgW
	 Z+BCSd31FZZbDvgAwMv02r1FBD6Omp0Hlyvfr0/orZZlRCUIsHiehSsLIP0BPRF0wZwXI
	 TtCgXQUGE0saiAiFo1K0dj3gmFtMe5rTyG9QoSpIGXQBWNf9/E0SDLlpFFmwtEKWH3XJN
	 abW2AXDWJwXHCwmk0KkmbYQ7O7E183aRqutgCqYvwmttvluHlwIfloyrE2WIT6w0RMvDf
	 oqDHNal799M05EVjfUzcvGIQK/ZizZQoAhHVxklUmuwrwB1BDeEOR+q1ndmK/tKBS4A==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793273145;
	h=DMARC-Filter:DKIM-Signature:Received:X-QQ-mid:Message-ID:
	 X-QQ-XMAILINFO:X-QQ-XMRINFO:From:To:Cc:Subject:Date:X-OQ-MSGID:
	 X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=Rlc0Qn2G92bUMErWlek3q+ofs6Y3b5n85QGfapsmbas=;
	b=gEM/7T+syM5NuHyerp3TafbEjQdguOO8wFDrqsconxDP2dQTxqFpXabZPYdYa7heMu4N
	 uy4s05poHP9t54o/PjFdnZMRMo692PncCPEDsu9Fa6CLv3YyjjdM0hTNGLCH16hmZPBR2
	 8bUAr4mFDab9CPaANNGW67P1LzKzhdbkAA4qadl/lS8OpbZ/e9enoEAD6sLAeSlbJyBdR
	 2VbaRhaDu3d/YFKS1DJCrXLHUR1BUxmtnETg/i61zBZSiRVaYw7GSlNIZ8f365lEwbdTf
	 ViAxnoqXm/DLKYDmO0v3Ty3lnHrn7SznjZzx0xlDLtRJ7ODd4n2YlU3TpGyr2tR6Fpw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=foxmail.com;
	spf=pass smtp.mailfrom=foxmail.com;
	dkim=pass header.d=foxmail.com header.i=@foxmail.com header.a=rsa-sha256 header.s=s201512 header.b=gFGWSDAX;
	arc=none smtp.remote-ip=162.62.58.216
X-Received: from out162-62-58-216.mail.qq.com (out162-62-58-216.mail.qq.com [162.62.58.216])
	(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D680606A31C
	for <netdev@vger.kernel.org>; Thu, 29 Oct 2026 11:25:43 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7D680606A31C
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=foxmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=foxmail.com
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com;
	s=s201512; t=1793273133;
	bh=Rlc0Qn2G92bUMErWlek3q+ofs6Y3b5n85QGfapsmbas=;
	h=From:To:Cc:Subject:Date:In-Reply-To:References;
	b=gFGWSDAXvJ4tjqIlmmVdf760KxLz/GtKNNMQAKoyKNSbZ78cAh6p5yxPIzSNZm0zu
	 lVSzxBJYymWiskHR/k8XFPCj/A8oEWQdH5vK58oObo8u37OSxd8P7aIOmrpZ7wCx25
	 WRnCXEdrI7Zbkc3+Ys6erWzUv1TQWcfv24SnWkIA=
X-Received: from localhost.localdomain ([240e:3bb:302c:4eb1:9b:594b:9d4d:93e4])
	by newxmesmtplogicsvrszc43-0.qq.com (NewEsmtp) with SMTP
	id 65DA727C; Thu, 29 Oct 2026 19:25:29 +0800
X-QQ-mid: xmsmtpt1793273129tpbznleuz
X-QQ-XMAILINFO: MllZffuBkEb5jDGd+ZCD7FauTXrgkOrDgmjTFeeCJ7T0FnCojKvVqs9C/0nE/8
	 pmB8swD6jKwKyFecidfwdfypwNR9mPPs2UD+ABoqCbxcIkyAxCNLgL971pAQ3ZVIxgOaL2ey6FvG
	 3tVUt+n1TFQQYLq0IZPLL27rnnow09UQ7BWFCpK30XsRB1Mfeo44l6Stc/2cRvY+kK1qlEAR7LB7
	 wEtyyLo3RfaXA/JVLt06qWGeTd1ATGcT2gzIhXTnY+SkrTjWo8y39XbOr2rXVQU/5S71i1rCM11+
	 Ou/fRtKdx5b6YBt4tWXxHnyU7b4Tfwp74Z5dM2Riiuhp3Oyqhbo2ykJCcFTWkXIZR2smeA3VJtix
	 Xm9v6PFHlB9x6iJI/nvsgnsx7IyaLGtSRH0ieGZYG30LIJU8xO2WLFVo9HdSHRkH80ockzUTf8OF
	 xY9fr1ALVVIq+uez3efEUVk5yA69r3AHJ2Q7XIWux3DqyLxWDcxQ7WIAzr+M2REL4Th3vLiuPP0T
	 qPdD3Ha1V+9ocZl61VyfiASBPM+buww127vwF22UBtzQp4F0s7Y+yoqnIoBioN7P8WMQoOzpkHQr
	 ce1BoP6zYkhJOsijQb1wFtpXYWsc4JL06KMufgLkg4GBEVEZd4wkzgFMdDZanb/dbcqSlplUyHrM
	 gnrEXGtOsnBdsO9aLBB40njkhU1hOf7ChkTR5vo9qL1C6Au7kJ98Sv3kgebYX43nGUTlDP9ObVtG
	 DpLi0u35q3kVD5f9ux6PCoT5ZQGtD9cF+oWC1KwgmhgyNpep//0EOgOebZJJ0NYg8NtT564sFnM1
	 yyL1WFehjHUkr/t0BweR83y5xKCbrBlhL4Sb0inm3UOuXDrnxh3jwbgxCct0ar4i7eFJ+zAtQnHG
	 An54wkDMFkIAaKOluARRJki23qXacTxIzfXCBRA5OR7JAWQwa1EIxn96OOJ51mzSCrtuLna59lSs
	 H2DvM5SmWXznAJ6NiBjOudWFQd0Tezx5TSQB+gvsy0FWert3wJ8KaKmaXOGhHQtInNI0CApXOsVv
	 2mTnrQ6R8/b17MzCPkxeCcjY2EvbRlHLFybCzXlHNUdiLBbwLUcG7im336kpo=
X-QQ-XMRINFO: Mp0Kj//9VHAxzExpfF+O8yhSrljjwrznVg==
X-Cc: daniel@makrotopia.org,
	andrew@lunn.ch,
	f.fainelli@gmail.com,
	olteanv@gmail.com,
	johan@kernel.org,
	kuba@kernel.org,
	pabeni@redhat.com
X-OQ-MSGID: <20261029112528.56652-1-memoriaru@foxmail.com>
X-Mailer: git-send-email 2.39.5 (Apple Git-154)
X-In-Reply-To: <tencent_6030CC520C02054D1B2925AEEF6FA92DC30A@qq.com>
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