summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorYang Yingliang <yangyingliang@huawei.com>2020-07-14 14:56:39 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-29 07:42:52 +0200
commit2c12c0ac37b4c8f7a6a4de6cbcd562f139d0a6f2 (patch)
treefa91504b55b9c0519ee3718d10a6c43a3806479a /drivers
parent2631d1bd96569d9a000645cc9955f229e0fbde5b (diff)
downloadlinux-stable-2c12c0ac37b4c8f7a6a4de6cbcd562f139d0a6f2.tar.gz
linux-stable-2c12c0ac37b4c8f7a6a4de6cbcd562f139d0a6f2.tar.bz2
linux-stable-2c12c0ac37b4c8f7a6a4de6cbcd562f139d0a6f2.zip
IB/umem: fix reference count leak in ib_umem_odp_get()
Add missing mmput() on error path to avoid ref-count leak. This problem is introduced by 79bb5b7ee177 ("RDMA/umem: Fix missing mmap_sem in get umem ODP call") and resolved by f27a0d50a4bc ("RDMA/umem: Use umem->owning_mm inside ODP"). So, it's only needed in stable-4.14 and stable-4.19. Fixes: 79bb5b7ee177 ("RDMA/umem: Fix missing mmap_sem in get umem ODP call") Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/core/umem_odp.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index 57b41125b146..688ce1846911 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -306,7 +306,8 @@ int ib_umem_odp_get(struct ib_ucontext *context, struct ib_umem *umem,
vma = find_vma(mm, ib_umem_start(umem));
if (!vma || !is_vm_hugetlb_page(vma)) {
up_read(&mm->mmap_sem);
- return -EINVAL;
+ ret_val = -EINVAL;
+ goto out_mm;
}
h = hstate_vma(vma);
umem->page_shift = huge_page_shift(h);