Skip to contentSkip to conversation

net/mlx5: fix RxQ resource cleanup

PATCH In review Dmitry Kozlyuk 2 participants 2 messages Oct 18, 2021 – Oct 20, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: fix RxQ resource cleanup

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 Michael Baum <[email protected]>
---
 drivers/net/mlx5/mlx5_trigger.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/mlx5/mlx5_trigger.c +1 -0
index 54173bfacb..0ecdd776fc 100644
@@ -182,6 +182,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.",
Signature · 1 line
2.25.1
#1 lore raw

Hi,

Quoted 19 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Dmitry Kozlyuk
Sent: Monday, October 18, 2021 8:25 PM
To: [email protected]
Cc: Michael Baum <[email protected]>; [email protected]; Matan Azrad <[email protected]>; Viacheslav Ovsiienko <[email protected]>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix RxQ resource cleanup

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

Quoted 8 lines

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

Fixes 1260a87b2889 ("net/mlx5: share Rx control code")
Cc Michael Baum <[email protected]>

Patch applied to next-net-mlx,

Kindest regards,
Raslan Darawsheh