Re: [PATCH] IB/mlx5: Fix memory leak in GSI QP destroy error path
From: Leon Romanovsky
Date: Tue Mar 31 2026 - 09:51:19 EST
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