mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 19:30:30 +09:00
net: sched: cbs: Avoid division by zero when calculating the port rate
[ Upstream commit83c8c3cf45] As explained in the "net: sched: taprio: Avoid division by zero on invalid link speed" commit, it is legal for the ethtool API to return zero as a link speed. So guard against it to ensure we don't perform a division by zero in kernel. Fixes:e0a7683d30("net/sched: cbs: fix port_rate miscalculation") Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Acked-by: Vinicius Costa Gomes <vinicius.gomes@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
13260106d3
commit
172c529cb0
@@ -310,7 +310,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q)
|
||||
if (err < 0)
|
||||
goto skip;
|
||||
|
||||
if (ecmd.base.speed != SPEED_UNKNOWN)
|
||||
if (ecmd.base.speed && ecmd.base.speed != SPEED_UNKNOWN)
|
||||
speed = ecmd.base.speed;
|
||||
|
||||
skip:
|
||||
|
||||
Reference in New Issue
Block a user