From: Dekel Peled Date: Wed, 3 Feb 2021 10:09:09 +0000 (+0200) Subject: net/mlx5: validate hash Rx queue pointer X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=207b4d06c33896ac723139b3af62bf710ce082f9;p=dpdk.git net/mlx5: validate hash Rx queue pointer Implementation of mlx5_hrxq_get() tries to get pointer to a hrxq object, by reusing an existing hrxq, or creating a new one. There is no check of the obtained pointer, so using it might result in error. This patch adds check of the pointer before using it, and return 0 if the pointer is NULL to indicate error. Fixes: e1592b6c4dea ("net/mlx5: make Rx queue thread safe") Cc: stable@dpdk.org Signed-off-by: Dekel Peled Acked-by: Matan Azrad --- diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c index 92e3a792e1..8f9ee97f7a 100644 --- a/drivers/net/mlx5/mlx5_rxq.c +++ b/drivers/net/mlx5/mlx5_rxq.c @@ -2353,7 +2353,9 @@ uint32_t mlx5_hrxq_get(struct rte_eth_dev *dev, return 0; hrxq = container_of(entry, typeof(*hrxq), entry); } - return hrxq->idx; + if (hrxq) + return hrxq->idx; + return 0; } /**