* [PATCH v2] RDMA/hns: Fix refcount leak in hns_roce_mmap
@ 2022-12-23 7:29 Miaoqian Lin
2022-12-24 1:22 ` xuhaoyue (A)
2022-12-28 12:20 ` Leon Romanovsky
0 siblings, 2 replies; 3+ messages in thread
From: Miaoqian Lin @ 2022-12-23 7:29 UTC (permalink / raw)
To: Haoyue Xu, Wenpeng Liang, Jason Gunthorpe, Leon Romanovsky,
Yixing Liu, linux-rdma, linux-kernel
Cc: linmq006
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;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] RDMA/hns: Fix refcount leak in hns_roce_mmap
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)
2022-12-28 12:20 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: xuhaoyue (A) @ 2022-12-24 1:22 UTC (permalink / raw)
To: Miaoqian Lin, Wenpeng Liang, Jason Gunthorpe, Leon Romanovsky,
Yixing Liu, linux-rdma, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] RDMA/hns: Fix refcount leak in hns_roce_mmap
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)
@ 2022-12-28 12:20 ` Leon Romanovsky
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2022-12-28 12:20 UTC (permalink / raw)
To: Wenpeng Liang, Yixing Liu, Jason Gunthorpe, Miaoqian Lin,
linux-kernel, linux-rdma, Haoyue Xu
On Fri, 23 Dec 2022 11:29:00 +0400, Miaoqian Lin wrote:
> rdma_user_mmap_entry_get_pgoff() takes the reference.
> Add missing rdma_user_mmap_entry_put() to release the reference.
>
>
Applied, thanks!
[1/1] RDMA/hns: Fix refcount leak in hns_roce_mmap
https://git.kernel.org/rdma/rdma/c/cf6a05c8494a8a
Best regards,
--
Leon Romanovsky <leon@kernel.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-28 12:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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)
2022-12-28 12:20 ` Leon Romanovsky
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox