From: Vladimir Oltean <[email protected]>
Date: Sun, 29 Sep 2019 02:37:22 +0300
> The check in taprio_set_picos_per_byte is currently not robust enough
> and will trigger this division by zero, due to e.g. PHYLINK not setting
> kset->base.speed when there is no PHY connected:
...
> Russell King points out that the ethtool API says zero is a valid return
> value of __ethtool_get_link_ksettings:
>
> * If it is enabled then they are read-only; if the link
> * is up they represent the negotiated link mode; if the link is down,
> * the speed is 0, %SPEED_UNKNOWN or the highest enabled speed and
> * @duplex is %DUPLEX_UNKNOWN or the best enabled duplex mode.
>
> So, it seems that taprio is not following the API... I'd suggest either
> fixing taprio, or getting agreement to change the ethtool API.
>
> The chosen path was to fix taprio.
>
> Fixes: 7b9eba7ba0c1 ("net/sched: taprio: fix picos_per_byte miscalculation")
> Signed-off-by: Vladimir Oltean <[email protected]>
Applied and queued up for -stable.