[PATCH net 0/3] net: dsa: qca8k: fix concurrent register and MIB autocast access

From: Stanislaw Pal

Date: Thu Oct 22 2026 - 15:32:26 EST


The netdev AI review of my net-next MIB statistics series [1] found
three bugs that are already in released kernels. They do not depend on
that series, so here they are for net:

1. Since the conversion to the regmap read/write API, the regmap uses
a shared work_buf but is created with .disable_locking. phylink's
resolve work and the LED callbacks access registers outside rtnl,
so concurrent users can swap or corrupt register and value.

2. An ethtool MIB request over Ethernet (autocast) that times out
leaves the caller's buffer published. Late frames then write into
the buffer after ethtool has freed it, and extra frames underflow
the frame counter.

3. The autocast handler reads up to 164 bytes of counters without
checking the frame length.

The MIB statistics series will be rebased on these once net-next
reopens.

Testing: on a GL-B3000 (IPQ5018 + QCA8337, CPU on port 0) with the qca
tagger, backported to OpenWrt's 6.18 kernel with PROVE_LOCKING. That
tree also carries the MIB statistics series, so a work polls the MIB
every 3 s next to ethtool -S. In four minutes under about 50 Mbit/s
of routed traffic, 938 MIB frames arrived after their request had
already returned, and all were dropped. Frames made artificially short
were left uncounted, and the requests fell back to register reads. The
ethtool and netdev counters stayed monotonic, and there were no lockdep,
refcount or other warnings.

[1] https://lore.kernel.org/netdev/20261019191137.307514-1-kuncy7@xxxxxxxxx/

Stanislaw Pal (3):
net: dsa: qca8k: let regmap serialize register access
net: dsa: qca8k: drop MIB autocast frames once the request is over
net: dsa: qca8k: check the length of MIB autocast frames

drivers/net/dsa/qca/qca8k-8xxx.c | 34 ++++++++++++++++++++++++++++++--
drivers/net/dsa/qca/qca8k.h | 3 ++-
2 files changed, 34 insertions(+), 3 deletions(-)

--
2.43.0