]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:36 +0000 (19:51 +0100)
commit3cc92d542384058a49fb9b174341c9c4b9cd7e37
tree92a47981cd3384c0532384a74762b36599a35222
parent9681a5217b028ebf239ce7eb55ec3c1b5f66dd8c
net/sched: cbs: Fix integer overflow in cbs_set_port_rate()

[ Upstream commit 397006ba5d918f9b74e734867e8fddbc36dc2282 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/sch_cbs.c