From: Michael Gur <michaelgur@nvidia.com>
To: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>,
jgg@ziepe.ca, leon@kernel.org
Cc: linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH rdma v1] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure
Date: Sun, 26 Apr 2026 12:19:09 +0300 [thread overview]
Message-ID: <77145fd5-25be-4791-973e-b9e111589763@nvidia.com> (raw)
In-Reply-To: <20260425011739.21557-1-prathameshdeshpande7@gmail.com>
On 4/25/2026 4:17 AM, 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.
>
> Jump to the existing cleanup path instead of returning directly.
>
> Fixes: 1efe8c0670d6 ("RDMA/core: Convert UMEM ODP DMA mapping to caching IOVA and page linkage")
> Signed-off-by: Prathamesh Deshpande <prathameshdeshpande7@gmail.com>
> ---
> drivers/infiniband/hw/mlx5/umr.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/mlx5/umr.c b/drivers/infiniband/hw/mlx5/umr.c
> index 29488fba21a0..14ed8e8182f8 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;
> + goto out;
The loop already checks !err in its condition, so a 'break' is
sufficient here to avoid adding a new label.
Thanks
> dma_sync_single_for_device(ddev, sg.addr, sg.length,
> DMA_TO_DEVICE);
> sg.length = ALIGN(size_to_map, MLX5_UMR_FLEX_ALIGNMENT);
> @@ -925,6 +925,7 @@ int mlx5r_umr_update_xlt(struct mlx5_ib_mr *mr, u64 idx, int npages,
> mlx5r_umr_update_offset(&wqe.ctrl_seg, idx * desc_size);
> err = mlx5r_umr_post_send_wait(dev, mr->mmkey.key, &wqe, true);
> }
> +out:
> sg.length = orig_sg_length;
> mlx5r_umr_unmap_free_xlt(dev, xlt, &sg);
> return err;
next prev parent reply other threads:[~2026-04-26 9:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-25 1:17 [PATCH rdma v1] RDMA/mlx5: Fix UMR XLT cleanup on ODP populate failure Prathamesh Deshpande
2026-04-26 9:19 ` Michael Gur [this message]
2026-04-26 13:33 ` Prathamesh Deshpande
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=77145fd5-25be-4791-973e-b9e111589763@nvidia.com \
--to=michaelgur@nvidia.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=prathameshdeshpande7@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox