Re: [PATCH rdma-next] RDMA/cxgb4: free STAG index when TPT entry write fails

From: Leon Romanovsky

Date: Wed Jul 29 2026 - 08:18:25 EST



On Sun, 26 Jul 2026 15:21:44 +0300, Leon Romanovsky wrote:
> write_tpt_entry() allocates a new STAG index with c4iw_get_resource() and
> bumps stats.stag.cur before programming the entry. When
> write_adapter_mem() fails, it returns the error without releasing the index
> or reversing the statistic. No MR is inserted into rhp->mrs, so
> deregistration never reclaims it, leaking the index until device teardown.
>
> Record whether this call allocated the index and, on a failed write, return
> it to tpt_table and decrement stats.stag.cur. Key the rollback on both the
> write error and that flag, not the error alone: a non-reset update carries
> a caller-owned STAG that this call did not allocate and must not free.
>
> [...]

Applied, thanks!

[1/1] RDMA/cxgb4: free STAG index when TPT entry write fails
https://git.kernel.org/rdma/rdma/c/fdfb5cea4bf070

Best regards,
--
Leon Romanovsky <leonro@xxxxxxxxxx>