Skip to content

Commit

Permalink
drivers: net: qlcnic: Fix potential memory leak in qlcnic_sriov_init()
Browse files Browse the repository at this point in the history
[ Upstream commit 01de112 ]

If vp alloc failed in qlcnic_sriov_init(), all previously allocated vp
needs to be freed.

Fixes: f197a7a ("qlcnic: VF-PF communication channel implementation")
Signed-off-by: Yuan Can <[email protected]>
Reviewed-by: Leon Romanovsky <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
  • Loading branch information
Yuan Can authored and codewalkerster committed Jun 13, 2023
1 parent f66f4e2 commit 203fa0e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,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:
Expand Down

0 comments on commit 203fa0e

Please sign in to comment.