Skip to content

net: macb: fix the link speed the taprio setup reads

Aleksei Sviridkin lkml netdev 2 versions – Applied

Status from this message: This series was applied to netdev/net.git (main)

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 3 repliesApplied 2/2
  2. v12 patches 5 repliesSuperseded

Patches in v2 All 2 applied

#Subject and filesSizeRepliesApplied
1/2net: macb: zero the link settings taprio reads backdrivers/net/ethernet/cadence/macb_main.c+2 -23 repliesApplied
2/2net: macb: reject an unknown link speed in the taprio setupdrivers/net/ethernet/cadence/macb_main.c+2 -20 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH net v2 0/2] net: macb: fix the link speed the taprio setup reads

Two small fixes in macb_taprio_setup_replace(), both in how it obtains the link speed it scales the schedule with.

The first: it hands phylink_ethtool_ksettings_get() a stack variable it never zeroed, while phylink fills only what the link mode provides and even reads one field back from the caller. The second: the speed check is written as "<= 0" on a u32, so SPEED_UNKNOWN passes it and turns into a 1 ns hardware limit that every entry then exceeds.

Compile-tested against net; the driver has no test surface, and no macb board here.

---
v2: both commit messages rewritten to name the uninitialised-memory
case first and the link-down case as the one that happens; the grown declaration keeps reverse xmas tree order; the error text is "Invalid speed %d, link-down?" (Théo Lebrun). ethtool_validate_speed() was considered for the check and does not fit: it accepts SPEED_UNKNOWN by definition, which is exactly the value patch 2 rejects (Andrew Lunn).
https://lore.kernel.org/netdev/[email protected]/

Aleksei Sviridkin (2):
net: macb: zero the link settings taprio reads back
net: macb: reject an unknown link speed in the taprio setup

 drivers/net/ethernet/cadence/macb_main.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Signature · 1 line
2.53.0