net/sched: cbs: Fix integer overflow in cbs_set_port_rate()
authorElena Salomatkina <esalomatkina@ispras.ru>
Sun, 13 Oct 2024 12:45:29 +0000 (15:45 +0300)
committerJakub Kicinski <kuba@kernel.org>
Wed, 16 Oct 2024 01:25:47 +0000 (18:25 -0700)
commit397006ba5d918f9b74e734867e8fddbc36dc2282
tree9a30fc5fceb8fdc873bf5e2e98812ac9f70908ce
parent95b3120a485f77a9bb8060bf3398311e3dcb6c65
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 <esalomatkina@ispras.ru>
Link: https://patch.msgid.link/20241013124529.1043-1-esalomatkina@ispras.ru
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/sch_cbs.c