net/mlx5: restrict Rx queue array access to boundary
authorMichael Baum <michaelba@nvidia.com>
Sun, 10 Apr 2022 09:25:27 +0000 (12:25 +0300)
committerRaslan Darawsheh <rasland@nvidia.com>
Thu, 21 Apr 2022 10:47:41 +0000 (12:47 +0200)
commit1573b07284caf92cad5479b539213c508d5583a6
treeefbddbde605429ac8a73ba6d277a457f093fc2e1
parent1b0037b1cb287cd4cc215b2d0fc974e5188a6959
net/mlx5: restrict Rx queue array access to boundary

The mlx5_rxq_get() function gets RxQ index and return RxQ priv
accordingly.

When it gets an invalid index, it accesses out of array bounds which
might cause undefined behavior.

This patch adds a check for invalid indexes before accessing to array.

Fixes: 0cedf34da78f ("net/mlx5: move Rx queue reference count")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_rxq.c