net: macb: reject an unknown link speed in the taprio setup

speed is a u32, so SPEED_UNKNOWN arrives as 0xffffffff and passes the
"speed <= 0" check, which only ever catches zero. That is what an
autonegotiating link reports while it is down: the limit derived from
the speed collapses to a nanosecond at most and the first entry fails
with a misleading "exceeds hardware limit". Zero stays covered, it is
what an interface that was never opened reports, and
enst_max_hw_interval() divides by it. Say which case it was in the
error.

Fixes: 89934dbf16 ("net: macb: Add TAPRIO traffic scheduling support")
Assisted-by: LLM
Signed-off-by: Aleksei Sviridkin <f@lex.la>
Link: https://patch.msgid.link/20260903123652.23900-3-f@lex.la
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
Aleksei Sviridkin 2026-09-03 12:36:52 +00:00 committed by Paolo Abeni
parent 0523d5c52a
commit 2b6c0e25a3

View File

@ -4329,8 +4329,8 @@ static int macb_taprio_setup_replace(struct net_device *netdev,
}
speed = kset.base.speed;
if (unlikely(speed <= 0)) {
netdev_err(netdev, "Invalid speed: %d\n", speed);
if (unlikely(speed == SPEED_UNKNOWN || !speed)) {
netdev_err(netdev, "Invalid speed %d, link-down?\n", speed);
return -EINVAL;
}