]> git.baikalelectronics.ru Git - kernel.git/commit
netdev: Enforce index cap in netdev_get_tx_queue
authorNick Child <nnac123@linux.ibm.com>
Tue, 21 Mar 2023 15:07:25 +0000 (10:07 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 24 May 2023 16:32:37 +0000 (17:32 +0100)
commitc4dc1cd4c5f250c238ed4853273f59669a7911c2
treeb2d7a873560e611f35b6527afd93dd48cb6ed245
parent71d09a8317e27367791ef6648555408a02794840
netdev: Enforce index cap in netdev_get_tx_queue

[ Upstream commit 1cc6571f562774f1d928dc8b3cff50829b86e970 ]

When requesting a TX queue at a given index, warn on out-of-bounds
referencing if the index is greater than the allocated number of
queues.

Specifically, since this function is used heavily in the networking
stack use DEBUG_NET_WARN_ON_ONCE to avoid executing a new branch on
every packet.

Signed-off-by: Nick Child <nnac123@linux.ibm.com>
Link: https://lore.kernel.org/r/20230321150725.127229-2-nnac123@linux.ibm.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
include/linux/netdevice.h