net/mlx5: fix Rx queue resource cleanup
authorDmitry Kozlyuk <dkozlyuk@nvidia.com>
Mon, 18 Oct 2021 17:24:56 +0000 (20:24 +0300)
committerRaslan Darawsheh <rasland@nvidia.com>
Thu, 21 Oct 2021 07:31:17 +0000 (09:31 +0200)
mlx5_rxq_start() allocates rxq_ctrl->obj and frees it on failure,
but did not set it to NULL. Later mlx5_rxq_release() could not recognize
this object is already freed and attempted to release its resources,
resulting in a crash:

    Configuring Port 0 (socket 0)
    mlx5_common: Failed to create RQ using DevX
    mlx5_common: Can't create DevX RQ object.
    mlx5_net: Port 0 Rx queue 0 RQ creation failure.
    Segmentation fault

Set rxq_ctrl->obj to NULL after it is freed to skip resource release.

Fixes: 1260a87b2889 ("net/mlx5: share Rx control code")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
drivers/net/mlx5/mlx5_trigger.c

index ca43bd5..dacf7ff 100644 (file)
@@ -230,6 +230,7 @@ mlx5_rxq_start(struct rte_eth_dev *dev)
                ret = priv->obj_ops.rxq_obj_new(dev, i);
                if (ret) {
                        mlx5_free(rxq_ctrl->obj);
+                       rxq_ctrl->obj = NULL;
                        goto error;
                }
                DRV_LOG(DEBUG, "Port %u rxq %u updated with %p.",