All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 4.19] IB/umem: fix reference count leak in ib_umem_odp_get()
@ 2020-07-14 10:57 Yang Yingliang
  2020-07-14  6:08 ` Greg KH
  2020-07-14 11:28 ` Jason Gunthorpe
  0 siblings, 2 replies; 7+ messages in thread
From: Yang Yingliang @ 2020-07-14 10:57 UTC (permalink / raw)
  To: stable; +Cc: sashal, gregkh, dledford, jgg

Add missing mmput() on error path to avoid ref-count leak.

This problem has already been resolved in mainline by
f27a0d50a4bc ("RDMA/umem: Use umem->owning_mm inside ODP").

Fixes: 79bb5b7ee177 ("RDMA/umem: Fix missing mmap_sem in get umem ODP call")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/infiniband/core/umem_odp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index eeafdc0beec7..08ef654ea9b8 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -347,7 +347,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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 4.19] IB/umem: fix reference count leak in ib_umem_odp_get()
@ 2020-06-19 16:03 Yang Yingliang
  2020-07-13 14:52 ` Greg KH
  0 siblings, 1 reply; 7+ messages in thread
From: Yang Yingliang @ 2020-06-19 16:03 UTC (permalink / raw)
  To: stable; +Cc: sashal, gregkh, yangyingliang

Add missing mmput() on error path to avoid ref-count leak.

This problem has already been resolved in mainline by
f27a0d50a4bc ("RDMA/umem: Use umem->owning_mm inside ODP").

Fixes: 79bb5b7ee177 ("RDMA/umem: Fix missing mmap_sem in get umem ODP call")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/infiniband/core/umem_odp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/umem_odp.c b/drivers/infiniband/core/umem_odp.c
index eeafdc0beec7..08ef654ea9b8 100644
--- a/drivers/infiniband/core/umem_odp.c
+++ b/drivers/infiniband/core/umem_odp.c
@@ -347,7 +347,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);
-- 
2.25.1


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

end of thread, other threads:[~2020-07-14 11:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-14 10:57 [PATCH 4.19] IB/umem: fix reference count leak in ib_umem_odp_get() Yang Yingliang
2020-07-14  6:08 ` Greg KH
2020-07-14  6:45   ` Yang Yingliang
2020-07-14 11:28 ` Jason Gunthorpe
  -- strict thread matches above, loose matches on Subject: below --
2020-06-19 16:03 Yang Yingliang
2020-07-13 14:52 ` Greg KH
2020-07-14  2:55   ` Yang Yingliang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.