stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Yang Yingliang <yangyingliang@huawei.com>
Cc: stable@vger.kernel.org, sashal@kernel.org,
	gregkh@linuxfoundation.org, dledford@redhat.com
Subject: Re: [PATCH 4.19] IB/umem: fix reference count leak in ib_umem_odp_get()
Date: Tue, 14 Jul 2020 08:28:50 -0300	[thread overview]
Message-ID: <20200714112850.GD25301@ziepe.ca> (raw)
In-Reply-To: <20200714105748.1151138-1-yangyingliang@huawei.com>

On Tue, Jul 14, 2020 at 10:57:48AM +0000, Yang Yingliang wrote:
> 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);

This patch does look correct, please address Greg's remarks.

Reviewed-by: Jason Gunthorpe <jgg@nvidia.com>

Thanks,
Jason

  parent reply	other threads:[~2020-07-14 11:28 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
  -- 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200714112850.GD25301@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=sashal@kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=yangyingliang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).