Netdev List
 help / color / mirror / Atom feed
[parent not found: <20261023204006.24923-1-memoriaru@foxmail.com>]
* [PATCH net v4 0/3] net: dsa: mxl862xx: bound FDB dump walk and validate BRIDGE_ALLOC ids
@ 2026-10-31  8:18 memoriaru
  2026-10-31  8:25 ` netdev-bot+sinfo
  0 siblings, 1 reply; 25+ messages in thread
From: memoriaru @ 2026-10-31  8:18 UTC (permalink / raw)
  To: netdev; +Cc: daniel, andrew, f.fainelli, olteanv, johan, kuba, pabeni

From: Zhang Hewei <memoriaru@foxmail.com>

Hello,

v4 of the mxl862xx robustness fixes, rebased onto the current net tree
and extended after the sashiko review of v3.

The v2 series did not apply because it carried full copies of
mxl862xx-api.h and mxl862xx.h predating the upstream restructure into
mxl862xx-host.c / mxl862xx-phylink.c; v3 re-ported the two fixes onto
the restructured driver. This version adds a third patch for the
firmware-result handling that the sashiko review of v3 flagged.

New in v4 (patch 3): MXL862XX_API_READ() returns the firmware result
value (>= 0) on success rather than an errno, so a CRC-valid firmware
status of 1..1023 comes back as a positive value that passes
"if (ret)" guards. The ALLOC-style call sites (QOS_METERALLOC,
EXTENDEDVLAN_ALLOC, VLANFILTER_ALLOC) tested the result with
"if (ret) return ret;" and could hand a positive firmware status to
callers that only check ret < 0. Patch 2 additionally splits the
transport result from the payload id inside
mxl862xx_allocate_bridge() so the bridge_id contract checks
(0 / 0xffff / in-use) run on the ret == 0 path only. The firmware
result-code semantics will be cross-checked against the GSW API
documentation; a follow-up can extend the same split to the remaining
API_READ call sites if that is preferred.

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

Changes since v3:
- patch 2: split transport status from the payload id in
  mxl862xx_allocate_bridge() (sashiko review: a positive firmware
  status passed "if (ret)" and was stored in priv->bridges[] by
  callers testing only ret < 0)
- new patch 3: same split at the QOS_METERALLOC / EXTENDEDVLAN_ALLOC /
  VLANFILTER_ALLOC call sites
- rebased onto net (cb284914e); no functional change to patch 1

Changes since v2:
- re-ported both fixes onto the restructured driver; dropped the
  mxl862xx-api.h / mxl862xx.h file creations

Changes since v1:
- walk limit checked after the "last" test; "conservative read limit"
  wording; BRIDGE_ALLOC validation extended to 0xffff and in-use ids;
  Fixes: tags added, self Reported-by dropped

Base-commit: cb284914e749388eef402938bdb3115fe1f6d337

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 (3):
  net: dsa: mxl862xx: bound FDB dump walk with a read limit
  net: dsa: mxl862xx: validate the bridge id returned by BRIDGE_ALLOC
  net: dsa: mxl862xx: do not leak firmware result values at ALLOC call sites

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

-- 
2.39.5 (Apple Git-154)


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2026-10-31  8:42 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20261022200434.80182-1-memoriaru@foxmail.com>
2026-10-22 20:04 ` [PATCH net 1/2] net: dsa: mxl862xx: bound FDB dump walk by table capacity memoriaru
2026-10-22 20:07   ` netdev-bot+sinfo
2026-10-22 20:14     ` memoriaru
2026-10-23 20:21   ` netdev-bot+sashiko
2026-10-23 20:32     ` memoriaru
2026-10-22 20:04 ` [PATCH net 2/2] net: dsa: mxl862xx: reject bridge_id 0 from BRIDGE_ALLOC memoriaru
2026-10-23 20:21   ` netdev-bot+sashiko
2026-10-23 20:40   ` [PATCH net v2 0/2] net: dsa: mxl862xx: bound FDB dump walk and validate BRIDGE_ALLOC ids memoriaru
2026-10-23 20:44     ` netdev-bot+sinfo
2026-10-23 21:03       ` memoriaru
2026-10-28 22:44         ` Jakub Kicinski
2026-10-29 11:25     ` [PATCH net v3 " memoriaru
     [not found]     ` <20261029112528.56652-1-memoriaru@foxmail.com>
2026-10-29 11:25       ` [PATCH net v3 1/2] net: dsa: mxl862xx: bound FDB dump walk with a read limit memoriaru
2026-10-29 11:30         ` netdev-bot+sinfo
2026-10-30  3:33           ` memoriaru
2026-10-30 22:24             ` Jakub Kicinski
2026-10-30 11:28         ` netdev-bot+sashiko
2026-10-29 11:25       ` [PATCH net v3 2/2] net: dsa: mxl862xx: validate the bridge id returned by BRIDGE_ALLOC memoriaru
2026-10-30 11:28         ` netdev-bot+sashiko
2026-10-31  2:43           ` memoriaru
     [not found] <20261023204006.24923-1-memoriaru@foxmail.com>
2026-10-23 20:40 ` [PATCH net v2 1/2] net: dsa: mxl862xx: bound FDB dump walk with a read limit memoriaru
2026-10-23 20:40 ` [PATCH net v2 2/2] net: dsa: mxl862xx: validate the bridge id returned by BRIDGE_ALLOC memoriaru
2026-10-31  8:18 [PATCH net v4 0/3] net: dsa: mxl862xx: bound FDB dump walk and validate BRIDGE_ALLOC ids memoriaru
2026-10-31  8:25 ` netdev-bot+sinfo
2026-10-31  8:41   ` memoriaru

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox