* [PATCH v2] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure
@ 2026-04-26 13:23 Prathamesh Deshpande
2026-05-11 10:02 ` Leon Romanovsky
0 siblings, 1 reply; 2+ messages in thread
From: Prathamesh Deshpande @ 2026-04-26 13:23 UTC (permalink / raw)
To: jgg, leon; +Cc: michaelgur, linux-rdma, linux-kernel, Prathamesh Deshpande
mlx5r_umr_update_xlt() allocates and DMA maps an XLT buffer with
mlx5r_umr_create_xlt(). The buffer is released by the common cleanup path
through mlx5r_umr_unmap_free_xlt().
After mlx5_odp_populate_xlt() became fallible, its error path returned
directly and skipped that cleanup. This leaks the XLT DMA mapping and
buffer. If the emergency XLT page was used, it also leaves
xlt_emergency_page_mutex locked.
Break out of the loop so execution falls through the existing cleanup path.
Fixes: 1efe8c0670d6 ("RDMA/core: Convert UMEM ODP DMA mapping to caching IOVA and page linkage")
Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
---
v2:
- Use 'break' instead of 'goto' as the loop already checks 'err'. (Michael Gur)
drivers/infiniband/hw/mlx5/umr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c
index 29488fba21a0..71f331ce6d89 100644
--- a/drivers/infiniband/hw/mlx5/umr.c
+++ b/drivers/infiniband/hw/mlx5/umr.c
@@ -915,7 +915,7 @@ int mlx5r_umr_update_xlt(struct mlx5_ib_mr *mr, u64 idx, int npages,
*/
err = mlx5_odp_populate_xlt(xlt, idx, npages, mr, flags);
if (err)
- return err;
+ break;
dma_sync_single_for_device(ddev, sg.addr, sg.length,
DMA_TO_DEVICE);
sg.length = ALIGN(size_to_map, MLX5_UMR_FLEX_ALIGNMENT);
--
2.43.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH v2] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure
2026-04-26 13:23 [PATCH v2] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure Prathamesh Deshpande
@ 2026-05-11 10:02 ` Leon Romanovsky
0 siblings, 0 replies; 2+ messages in thread
From: Leon Romanovsky @ 2026-05-11 10:02 UTC (permalink / raw)
To: jgg, Prathamesh Deshpande; +Cc: michaelgur, linux-rdma, linux-kernel
On Sun, 26 Apr 2026 14:23:41 +0100, Prathamesh Deshpande wrote:
> mlx5r_umr_update_xlt() allocates and DMA maps an XLT buffer with
> mlx5r_umr_create_xlt(). The buffer is released by the common cleanup path
> through mlx5r_umr_unmap_free_xlt().
>
> After mlx5_odp_populate_xlt() became fallible, its error path returned
> directly and skipped that cleanup. This leaks the XLT DMA mapping and
> buffer. If the emergency XLT page was used, it also leaves
> xlt_emergency_page_mutex locked.
>
> [...]
Applied, thanks!
[1/1] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure
https://git.kernel.org/rdma/rdma/c/40d05a2e003357
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-05-11 10:02 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-04-26 13:23 [PATCH v2] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure Prathamesh Deshpande
2026-05-11 10:02 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®