net/mlx5: fix crash on close after failed start

If mlx5_rxq_start() failed and rxq_ctrl was not initialized,
mlx5_rxq_obj_verify() would segfault in an attempt to dereference it.
Add a check that rxq_ctrl is not NULL before accessing its members.

Fixes: 09c2555303 ("net/mlx5: support shared Rx queue")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
Dmitry Kozlyuk 2021-11-23 22:22:27 +02:00 committed by Raslan Darawsheh
parent 8947eebc99
commit 0ece5de3c4

View File

@ -1271,6 +1271,8 @@ mlx5_rxq_obj_verify(struct rte_eth_dev *dev)
struct mlx5_rxq_obj *rxq_obj;
LIST_FOREACH(rxq_obj, &priv->rxqsobj, next) {
if (rxq_obj->rxq_ctrl == NULL)
continue;
if (rxq_obj->rxq_ctrl->rxq.shared &&
!LIST_EMPTY(&rxq_obj->rxq_ctrl->owners))
continue;