From: David Miller <davem@davemloft.net>
To: olteanv@gmail.com
Cc: vinicius.gomes@intel.com, jhs@mojatatu.com,
xiyou.wangcong@gmail.com, netdev@vger.kernel.org
Subject: Re: [PATCH net] net: sched: taprio: Avoid division by zero on invalid link speed
Date: Tue, 01 Oct 2019 09:51:13 -0700 (PDT) [thread overview]
Message-ID: <20191001.095113.383452363568954178.davem@davemloft.net> (raw)
In-Reply-To: <20190928233722.15054-1-olteanv@gmail.com>
From: Vladimir Oltean <olteanv@gmail.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@gmail.com>
Applied and queued up for -stable.
prev parent reply other threads:[~2019-10-01 16:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-28 23:37 [PATCH net] net: sched: taprio: Avoid division by zero on invalid link speed Vladimir Oltean
2019-09-30 16:39 ` Vinicius Costa Gomes
2019-10-01 16:51 ` David Miller [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191001.095113.383452363568954178.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.com \
--cc=vinicius.gomes@intel.com \
--cc=xiyou.wangcong@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).