Skip to contentSkip to conversation

IB/mlx5: Fix a potential memory leak in setup_qp()

PATCH Applied Wanhui Fu 4 participants 4 messages Nov 21 – Nov 25

Subsystems (2)
lore
Share & tools
lore

Wanhui Fu

author
#0 lore raw

PATCH 1/1 IB/mlx5: Fix a potential memory leak in setup_qp()

create_gsi_ud_qp() creates a QP but the QP is not
released if modify_to_rts() fails. Free the QP by
calling ib_destroy_qp().

Fixes ebab41cff4db ("IB/mlx5: Create multiple transmission GSI QPs")
---
 drivers/infiniband/hw/mlx5/gsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/gsi.c +1 -1
index b2e2a219639d..535a9f45fb33 100644
@@ -316,7 +316,7 @@ static void setup_qp(struct mlx5_ib_gsi_qp *gsi, u16 qp_index)
 	return;
 
 err_destroy_qp:
-	WARN_ON_ONCE(qp);
+	WARN_ON_ONCE(ib_destroy_qp(qp));
 }
 
 int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
Signature · 1 line
2.25.1
#1 lore raw
Sashiko has reviewed this patch and found no issues.
Quoted 6 lines

create_gsi_ud_qp() creates a QP but the QP is not
released if modify_to_rts() fails. Free the QP by
calling ib_destroy_qp().

Fixes ebab41cff4db ("IB/mlx5: Create multiple transmission GSI QPs")

Sashiko has reviewed this patch and found no issues.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Wanhui Fu
Quoted 27 lines · Wanhui Fu

External email: Use caution opening links or attachments

create_gsi_ud_qp() creates a QP but the QP is not
released if modify_to_rts() fails. Free the QP by
calling ib_destroy_qp().

Fixes ebab41cff4db ("IB/mlx5: Create multiple transmission GSI QPs")
---
  drivers/infiniband/hw/mlx5/gsi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/gsi.c +1 -2
index b2e2a219639d..535a9f45fb33 100644
@@ -316,7 +316,7 @@ static void setup_qp(struct mlx5_ib_gsi_qp *gsi, u16 qp_index)
         return;
 
  err_destroy_qp:
-       WARN_ON_ONCE(qp);
+       WARN_ON_ONCE(ib_destroy_qp(qp));
  }
 
  int mlx5_ib_gsi_modify_qp(struct ib_qp *qp, struct ib_qp_attr *attr,
--
Quoted 1 line

2.25.1