net/mlx5: fix crash on close after failed start
authorDmitry Kozlyuk <dkozlyuk@nvidia.com>
Tue, 23 Nov 2021 20:22:27 +0000 (22:22 +0200)
committerRaslan Darawsheh <rasland@nvidia.com>
Tue, 23 Nov 2021 20:39:05 +0000 (21:39 +0100)
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: 09c2555303be ("net/mlx5: support shared Rx queue")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_rxq.c

index 47dc247..191f1e4 100644 (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;