]> git.baikalelectronics.ru Git - kernel.git/commit
net/mlx5e: IPoIB, Block PKEY interfaces with less rx queues than parent
authorDragos Tatulea <dtatulea@nvidia.com>
Fri, 25 Nov 2022 15:51:19 +0000 (17:51 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Jan 2023 10:58:30 +0000 (11:58 +0100)
commit66bd28727806c70ca44d5e30da90676b94d8ea39
tree23c2cc4cd05522e9212cb4f60067f1ea5c5b93de
parentc01e47667936f7d784f14b44f1077903fcb93241
net/mlx5e: IPoIB, Block PKEY interfaces with less rx queues than parent

[ Upstream commit 31c70bfe58ef09fe36327ddcced9143a16e9e83d ]

A user is able to configure an arbitrary number of rx queues when
creating an interface via netlink. This doesn't work for child PKEY
interfaces because the child interface uses the parent receive channels.

Although the child shares the parent's receive channels, the number of
rx queues is important for the channel_stats array: the parent's rx
channel index is used to access the child's channel_stats. So the array
has to be at least as large as the parent's rx queue size for the
counting to work correctly and to prevent out of bound accesses.

This patch checks for the mentioned scenario and returns an error when
trying to create the interface. The error is propagated to the user.

Fixes: 16b77a7d66bf ("net/mlx5e: Use dynamic per-channel allocations in stats")
Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib_vlan.c