Skip to content

Commit 397006b

Browse files
Elena Salomatkinakuba-moo
authored andcommitted
net/sched: cbs: Fix integer overflow in cbs_set_port_rate()
The subsequent calculation of port_rate = speed * 1000 * BYTES_PER_KBIT, where the BYTES_PER_KBIT is of type LL, may cause an overflow. At least when speed = SPEED_20000, the expression to the left of port_rate will be greater than INT_MAX. Found by Linux Verification Center (linuxtesting.org) with SVACE. Signed-off-by: Elena Salomatkina <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 95b3120 commit 397006b

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sched/sch_cbs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ static void cbs_set_port_rate(struct net_device *dev, struct cbs_sched_data *q)
310310
{
311311
struct ethtool_link_ksettings ecmd;
312312
int speed = SPEED_10;
313-
int port_rate;
313+
s64 port_rate;
314314
int err;
315315

316316
err = __ethtool_get_link_ksettings(dev, &ecmd);

0 commit comments

Comments
 (0)