RDMA/rxe: Fix memleak in rxe_mem_init_user
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Wed, 19 Aug 2020 07:56:32 +0000 (15:56 +0800)
committerJason Gunthorpe <jgg@nvidia.com>
Thu, 27 Aug 2020 11:45:59 +0000 (08:45 -0300)
When page_address() fails, umem should be freed just like when
rxe_mem_alloc() fails.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Link: https://lore.kernel.org/r/20200819075632.22285-1-dinghao.liu@zju.edu.cn
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_mr.c

index cdd811a..ce24144 100644 (file)
@@ -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;
                        }