]> 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 19:03:47 +0000 (20:03 +0100)
commitef18243f8ecb2592af2f4eee91dc652b972fd078
treefcdb1730bfab7b238d2a3497dc64d1d13d0f9bdb
parentff3e39bc3cc6629d16d8653dc280e3c6a5cb667c
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