aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorYuan Can <yuancan@huawei.com>2022-12-07 08:54:10 +0000
committerDavid S. Miller <davem@davemloft.net>2022-12-09 10:52:43 +0000
commit01de1123322e4fe1bbd0fcdf0982511b55519c03 (patch)
tree07c054c18e78cacbddd76d0f12b95f5de7081961
parentnet: stmmac: fix possible memory leak in stmmac_dvr_probe() (diff)
downloadwireguard-linux-01de1123322e4fe1bbd0fcdf0982511b55519c03.tar.xz
wireguard-linux-01de1123322e4fe1bbd0fcdf0982511b55519c03.zip
drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp needs to be freed. Fixes: f197a7aa6288 ("qlcnic: VF-PF communication channel implementation") Signed-off-by: Yuan Can <yuancan@huawei.com> Reviewed-by: Leon Romanovsky <leonro@nvidia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
index 9282321c2e7f..f9dd50152b1e 100644
--- a/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
+++ b/drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
@@ -221,6 +221,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
return 0;
qlcnic_destroy_async_wq:
+ while (i--)
+ kfree(sriov->vf_info[i].vp);
destroy_workqueue(bc->bc_async_wq);
qlcnic_destroy_trans_wq: