The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "xuhaoyue (A)" <xuhaoyue1@hisilicon.com>
To: Miaoqian Lin <linmq006@gmail.com>,
	Wenpeng Liang <liangwenpeng@huawei.com>,
	Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
	Yixing Liu <liuyixing1@huawei.com>, <linux-rdma@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] RDMA/hns: Fix refcount leak in hns_roce_mmap
Date: Sat, 24 Dec 2022 09:22:36 +0800	[thread overview]
Message-ID: <2399c7f2-61bf-de85-28dc-ad8fe89ea671@hisilicon.com> (raw)
In-Reply-To: <20221223072900.802728-1-linmq006@gmail.com>

On 2022/12/23 15:29:00, Miaoqian Lin wrote:
> rdma_user_mmap_entry_get_pgoff() takes the reference.
> Add missing rdma_user_mmap_entry_put() to release the reference.
> 
> Fixes: 0045e0d3f42e ("RDMA/hns: Support direct wqe of userspace")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
> ---
> change in v2:
> - use goto label to manage the release.
> ---
>  drivers/infiniband/hw/hns/hns_roce_main.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> index 8ba68ac12388..946ba1109e87 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_main.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
> @@ -443,14 +443,15 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
>  		prot = pgprot_device(vma->vm_page_prot);
>  		break;
>  	default:
> -		return -EINVAL;
> +		ret = -EINVAL;
> +		goto out;
>  	}
>  
>  	ret = rdma_user_mmap_io(uctx, vma, pfn, rdma_entry->npages * PAGE_SIZE,
>  				prot, rdma_entry);
>  
> +out:
>  	rdma_user_mmap_entry_put(rdma_entry);
> -
>  	return ret;
>  }
>  
> 

Thank you. For the patch:
Acked-by Haoyue Xu <xuhaoyue1@hisilicon.com>

Regards,
Haoyue

  reply	other threads:[~2022-12-24  1:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23  7:29 [PATCH v2] RDMA/hns: Fix refcount leak in hns_roce_mmap Miaoqian Lin
2022-12-24  1:22 ` xuhaoyue (A) [this message]
2022-12-28 12:20 ` Leon Romanovsky

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=2399c7f2-61bf-de85-28dc-ad8fe89ea671@hisilicon.com \
    --to=xuhaoyue1@hisilicon.com \
    --cc=jgg@ziepe.ca \
    --cc=leon@kernel.org \
    --cc=liangwenpeng@huawei.com \
    --cc=linmq006@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liuyixing1@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