mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 10:49:33 +00:00
RDMA/usnic: Fix memleak in find_free_vf_and_create_qp_grp
commita306aba9c8
upstream. If usnic_ib_qp_grp_create() fails at the first call, dev_list will not be freed on error, which leads to memleak. Fixes:e3cf00d0a8
("IB/usnic: Add Cisco VIC low-level hardware driver") Link: https://lore.kernel.org/r/20201226074248.2893-1-dinghao.liu@zju.edu.cn Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
9dd21048ad
commit
102f2a4047
1 changed files with 3 additions and 0 deletions
|
@ -188,6 +188,7 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
|
||||||
|
|
||||||
}
|
}
|
||||||
usnic_uiom_free_dev_list(dev_list);
|
usnic_uiom_free_dev_list(dev_list);
|
||||||
|
dev_list = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Try to find resources on an unused vf */
|
/* Try to find resources on an unused vf */
|
||||||
|
@ -212,6 +213,8 @@ find_free_vf_and_create_qp_grp(struct usnic_ib_dev *us_ibdev,
|
||||||
qp_grp_check:
|
qp_grp_check:
|
||||||
if (IS_ERR_OR_NULL(qp_grp)) {
|
if (IS_ERR_OR_NULL(qp_grp)) {
|
||||||
usnic_err("Failed to allocate qp_grp\n");
|
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 ERR_PTR(qp_grp ? PTR_ERR(qp_grp) : -ENOMEM);
|
||||||
}
|
}
|
||||||
return qp_grp;
|
return qp_grp;
|
||||||
|
|
Loading…
Reference in a new issue