[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <20191001.095113.383452363568954178.davem@davemloft.net>
Date: Tue, 01 Oct 2019 09:51:13 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: olteanv@...il.com
Cc: vinicius.gomes@...el.com, jhs@...atatu.com,
xiyou.wangcong@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH net] net: sched: taprio: Avoid division by zero on
invalid link speed
From: Vladimir Oltean <olteanv@...il.com>
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 <olteanv@...il.com>
Applied and queued up for -stable.
Powered by blists - more mailing lists