RDMA/core: Fix FRMR set pinned push error path

Add destruction of FRMR handles in case the push to the pool fails.
This prevents resources leak in case pool page allocation fails.

Fixes: 020d189d16 ("RDMA/core: Add pinned handles to FRMR pools")
Link: https://patch.msgid.link/r/20260610000145.820592-6-michaelgur@nvidia.com
Signed-off-by: Michael Guralnik <michaelgur@nvidia.com>
Reviewed-by: Tao Cui <cuitao@kylinos.cn>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Michael Guralnik 2026-06-10 03:01:41 +03:00 committed by Jason Gunthorpe
parent c6936506ed
commit 41a707d027

View File

@ -461,11 +461,16 @@ int ib_frmr_pools_set_pinned(struct ib_device *device, struct ib_frmr_key *key,
ret = push_handle_to_queue_locked(&pool->queue,
handles[i]);
if (ret)
goto end;
break;
}
spin_unlock(&pool->lock);
if (ret) {
/* Destroy handles created but never pushed to the pool. */
pools->pool_ops->destroy_frmrs(device, &handles[i],
needed_handles - i);
}
end:
spin_unlock(&pool->lock);
kfree(handles);
schedule_aging: