linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user
@ 2020-08-19  7:56 Dinghao Liu
  2020-08-19  8:38 ` Zhu Yanjun
  2020-08-27 11:47 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2020-08-19  7:56 UTC (permalink / raw)
  To: dinghao.liu, kjlu
  Cc: Zhu Yanjun, Doug Ledford, Jason Gunthorpe, linux-rdma, linux-kernel

When page_address() fails, umem should be freed just
like when rxe_mem_alloc() fails.

Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
 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);
 				err = -ENOMEM;
 				goto err1;
 			}
-- 
2.17.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user
  2020-08-19  7:56 [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user Dinghao Liu
@ 2020-08-19  8:38 ` Zhu Yanjun
  2020-08-27 11:47 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Zhu Yanjun @ 2020-08-19  8:38 UTC (permalink / raw)
  To: Dinghao Liu
  Cc: kjlu, Zhu Yanjun, Doug Ledford, Jason Gunthorpe, linux-rdma, LKML

On Wed, Aug 19, 2020 at 3:59 PM Dinghao Liu <dinghao.liu@zju.edu.cn> wrote:
>
> When page_address() fails, umem should be freed just
> like when rxe_mem_alloc() fails.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user
  2020-08-19  7:56 [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user Dinghao Liu
  2020-08-19  8:38 ` Zhu Yanjun
@ 2020-08-27 11:47 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2020-08-27 11:47 UTC (permalink / raw)
  To: Dinghao Liu; +Cc: kjlu, Zhu Yanjun, Doug Ledford, linux-rdma, linux-kernel

On Wed, Aug 19, 2020 at 03:56:32PM +0800, Dinghao Liu wrote:
> When page_address() fails, umem should be freed just
> like when rxe_mem_alloc() fails.
> 
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
>  drivers/infiniband/sw/rxe/rxe_mr.c | 1 +
>  1 file changed, 1 insertion(+)

Applied to for-rc, I added a fixes line

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-27 15:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-19  7:56 [PATCH] RDMA/rxe: Fix memleak in rxe_mem_init_user Dinghao Liu
2020-08-19  8:38 ` Zhu Yanjun
2020-08-27 11:47 ` Jason Gunthorpe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).