* [PATCH] RDMA/hns: Fix refcount leak in hns_roce_mmap
@ 2022-12-20 11:30 Miaoqian Lin
2022-12-23 3:51 ` xuhaoyue (A)
0 siblings, 1 reply; 2+ messages in thread
From: Miaoqian Lin @ 2022-12-20 11:30 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 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>
---
drivers/infiniband/hw/hns/hns_roce_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
index 8ba68ac12388..fbff8df9236d 100644
--- a/drivers/infiniband/hw/hns/hns_roce_main.c
+++ b/drivers/infiniband/hw/hns/hns_roce_main.c
@@ -443,6 +443,7 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
prot = pgprot_device(vma->vm_page_prot);
break;
default:
+ rdma_user_mmap_entry_put(rdma_entry);
return -EINVAL;
}
--
2.25.1
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] RDMA/hns: Fix refcount leak in hns_roce_mmap
2022-12-20 11:30 [PATCH] RDMA/hns: Fix refcount leak in hns_roce_mmap Miaoqian Lin
@ 2022-12-23 3:51 ` xuhaoyue (A)
0 siblings, 0 replies; 2+ messages in thread
From: xuhaoyue (A) @ 2022-12-23 3:51 UTC (permalink / raw)
To: Miaoqian Lin, Wenpeng Liang, Jason Gunthorpe, Leon Romanovsky,
Yixing Liu, linux-rdma, linux-kernel
Thank you. This patch is right. Could you change it to this form?
default:
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;
On 2022/12/20 19:30:47, Miaoqian Lin wrote:
> rdma_user_mmap_entry_get_pgoff() takes 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>
> ---
> drivers/infiniband/hw/hns/hns_roce_main.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c
> index 8ba68ac12388..fbff8df9236d 100644
> --- a/drivers/infiniband/hw/hns/hns_roce_main.c
> +++ b/drivers/infiniband/hw/hns/hns_roce_main.c
> @@ -443,6 +443,7 @@ static int hns_roce_mmap(struct ib_ucontext *uctx, struct vm_area_struct *vma)
> prot = pgprot_device(vma->vm_page_prot);
> break;
> default:
> + rdma_user_mmap_entry_put(rdma_entry);
> return -EINVAL;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-23 3:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-20 11:30 [PATCH] RDMA/hns: Fix refcount leak in hns_roce_mmap Miaoqian Lin
2022-12-23 3:51 ` xuhaoyue (A)
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®