Re: [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user

From: Zhu Yanjun
Date: Wed Aug 19 2020 - 04:39:06 EST


On Wed, Aug 19, 2020 at 3:59 PM Dinghao Liu <dinghao.liu@xxxxxxxxxx> wrote:
>
> When page_address() fails, umem should be freed just
> like when rxe_mem_alloc() fails.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
> ---
> drivers/infiniband/sw/rxe/rxe_mr.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe_mr.c b/drivers/infiniband/sw/rxe/rxe_mr.c
> index cdd811a45120..ce24144de16a 100644
> --- a/drivers/infiniband/sw/rxe/rxe_mr.c
> +++ b/drivers/infiniband/sw/rxe/rxe_mr.c
> @@ -205,6 +205,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
> vaddr = page_address(sg_page_iter_page(&sg_iter));
> if (!vaddr) {
> pr_warn("null vaddr\n");
> + ib_umem_release(umem);
seems reasonable.

Thanks,

Zhu Yanjun
> err = -ENOMEM;
> goto err1;
> }
> --
> 2.17.1
>