* [PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
@ 2020-12-26 7:42 Dinghao Liu
2020-12-27 7:24 ` Leon Romanovsky
2021-01-07 20:41 ` Jason Gunthorpe
0 siblings, 2 replies; 3+ messages in thread
From: Dinghao Liu @ 2020-12-26 7:42 UTC (permalink / raw)
To: dinghao.liu, kjlu
Cc: Christian Benvenuti, Nelson Escobar, Doug Ledford,
Jason Gunthorpe, linux-rdma, linux-kernel
If usnic_ib_qp_grp_create() fails at the first call, dev_list
will not be freed on error, which leads to memleak.
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
---
drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
index 38a37770c016..3705c6b8b223 100644
--- a/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
+++ b/drivers/infiniband/hw/usnic/usnic_ib_verbs.c
@@ -214,6 +214,7 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
}
usnic_uiom_free_dev_list(dev_list);
+ dev_list = NULL;
}
/* Try to find resources on an unused vf */
@@ -239,6 +240,8 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
qp_grp_check:
if (IS_ERR_OR_NULL(qp_grp)) {
usnic_err("Failed to allocate qp_grp\n");
+ if (usnic_ib_share_vf)
+ usnic_uiom_free_dev_list(dev_list);
return ERR_PTR(qp_grp ? PTR_ERR(qp_grp) : -ENOMEM);
}
return qp_grp;
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
2020-12-26 7:42 [PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp Dinghao Liu
@ 2020-12-27 7:24 ` Leon Romanovsky
2021-01-07 20:41 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Leon Romanovsky @ 2020-12-27 7:24 UTC (permalink / raw)
To: Dinghao Liu
Cc: kjlu, Christian Benvenuti, Nelson Escobar, Doug Ledford,
Jason Gunthorpe, linux-rdma, linux-kernel
On Sat, Dec 26, 2020 at 03:42:48PM +0800, Dinghao Liu wrote:
> If usnic_ib_qp_grp_create() fails at the first call, dev_list
> will not be freed on error, which leads to memleak.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> ---
> drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 3 +++
> 1 file changed, 3 insertions(+)
>
Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
Thanks,
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
2020-12-26 7:42 [PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp Dinghao Liu
2020-12-27 7:24 ` Leon Romanovsky
@ 2021-01-07 20:41 ` Jason Gunthorpe
1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-01-07 20:41 UTC (permalink / raw)
To: Dinghao Liu
Cc: kjlu, Christian Benvenuti, Nelson Escobar, Doug Ledford,
linux-rdma, linux-kernel
On Sat, Dec 26, 2020 at 03:42:48PM +0800, Dinghao Liu wrote:
> If usnic_ib_qp_grp_create() fails at the first call, dev_list
> will not be freed on error, which leads to memleak.
>
> Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
> Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
> ---
> drivers/infiniband/hw/usnic/usnic_ib_verbs.c | 3 +++
> 1 file changed, 3 insertions(+)
Applied to for-rc with
Fixes: e3cf00d0a87f ("IB/usnic: Add Cisco VIC low-level hardware driver")
Thanks,
Jason
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-07 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-26 7:42 [PATCH] RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp Dinghao Liu
2020-12-27 7:24 ` Leon Romanovsky
2021-01-07 20:41 ` Jason Gunthorpe
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.