Skip to content

Commit 01de112

Browse files
Yuan Candavem330
authored andcommitted
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: 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]>
1 parent a137f3f commit 01de112

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/net/ethernet/qlogic/qlcnic/qlcnic_sriov_common.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ int qlcnic_sriov_init(struct qlcnic_adapter *adapter, int num_vfs)
221221
return 0;
222222

223223
qlcnic_destroy_async_wq:
224+
while (i--)
225+
kfree(sriov->vf_info[i].vp);
224226
destroy_workqueue(bc->bc_async_wq);
225227

226228
qlcnic_destroy_trans_wq:

0 commit comments

Comments
 (0)