drivers/infiniband/hw/mlx5/gsi.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
In mlx5_ib_destroy_gsi(), if the call to ib_destroy_qp() fails for
the hardware receive QP (gsi->rx_qp), the function currently returns
early. This results in a memory leak of the software resources
(outstanding_wrs, tx_qps) and the 'gsi' structure itself.
Align the GSI destroy path with the 'best-effort' cleanup pattern. Even
if the hardware fails to release the QP, proceed with the software
cleanup to prevent orphan allocations.
Fixes: d16e91daf446 ("IB/mlx5: Add GSI QP wrapper")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
---
drivers/infiniband/hw/mlx5/gsi.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/infiniband/hw/mlx5/gsi.c b/drivers/infiniband/hw/mlx5/gsi.c
index b2e2a219639d..2272236e7f7f 100644
--- a/drivers/infiniband/hw/mlx5/gsi.c
+++ b/drivers/infiniband/hw/mlx5/gsi.c
@@ -175,11 +175,9 @@ int mlx5_ib_destroy_gsi(struct mlx5_ib_qp *mqp)
int ret;
ret = ib_destroy_qp(gsi->rx_qp);
- if (ret) {
+ if (ret)
mlx5_ib_warn(dev, "unable to destroy hardware GSI QP. error %d\n",
ret);
- return ret;
- }
dev->devr.ports[port_num - 1].gsi = NULL;
gsi->rx_qp = NULL;
--
2.43.0
On Tue, Mar 31, 2026 at 01:48:10AM +0100, Prathamesh Deshpande wrote: > In mlx5_ib_destroy_gsi(), if the call to ib_destroy_qp() fails for > the hardware receive QP (gsi->rx_qp), the function currently returns > early. This results in a memory leak of the software resources > (outstanding_wrs, tx_qps) and the 'gsi' structure itself. > > Align the GSI destroy path with the 'best-effort' cleanup pattern. Even > if the hardware fails to release the QP, proceed with the software > cleanup to prevent orphan allocations. GSI QP are different from other "best-effort" failures. It MUST to fail. We are intentionally leaking resources here. Thanks
On Tue, Mar 31, 2026 at 04:45:08PM +0300, Leon Romanovsky wrote: > GSI QP are different from other "best-effort" failures. It MUST to fail. > We are intentionally leaking resources here. Hi Leon, Thank you for the explanation. I understand now that for GSI QPs, the hardware constraints make a memory leak preferable to the risk of an inconsistency in this failure path. I'll keep this in mind for future mlx5 cleanup patches. Thanks, Prathamesh
© 2016 - 2026 Red Hat, Inc.