Commit e3ddd606 authored by Dinghao Liu's avatar Dinghao Liu Committed by Jason Gunthorpe

RDMA/rxe: Fix memleak in rxe_mem_init_user

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

Fixes: 8700e3e7 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20200819075632.22285-1-dinghao.liu@zju.edu.cnSigned-off-by: default avatarDinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 60b1af64
...@@ -205,6 +205,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start, ...@@ -205,6 +205,7 @@ int rxe_mem_init_user(struct rxe_pd *pd, u64 start,
vaddr = page_address(sg_page_iter_page(&sg_iter)); vaddr = page_address(sg_page_iter_page(&sg_iter));
if (!vaddr) { if (!vaddr) {
pr_warn("null vaddr\n"); pr_warn("null vaddr\n");
ib_umem_release(umem);
err = -ENOMEM; err = -ENOMEM;
goto err1; goto err1;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment