mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
i40e: fix potential memory leaks in i40e_remove()
[ Upstream commit 5ca636d927a106780451d957734f02589b972e2b ] Instead of freeing memory of a single VSI, make sure the memory for all VSIs is cleared before releasing VSIs. Add releasing of their resources in a loop with the iteration number equal to the number of allocated VSIs. Fixes: 41c445ff0f48 ("i40e: main driver core") Signed-off-by: Andrii Staikov <andrii.staikov@intel.com> Signed-off-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Simon Horman <horms@kernel.org> Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
3b717ad0e9
commit
7472dfd33b
@ -11882,11 +11882,15 @@ static void i40e_remove(struct pci_dev *pdev)
|
||||
i40e_switch_branch_release(pf->veb[i]);
|
||||
}
|
||||
|
||||
/* Now we can shutdown the PF's VSI, just before we kill
|
||||
/* Now we can shutdown the PF's VSIs, just before we kill
|
||||
* adminq and hmc.
|
||||
*/
|
||||
if (pf->vsi[pf->lan_vsi])
|
||||
i40e_vsi_release(pf->vsi[pf->lan_vsi]);
|
||||
for (i = pf->num_alloc_vsi; i--;)
|
||||
if (pf->vsi[i]) {
|
||||
i40e_vsi_close(pf->vsi[i]);
|
||||
i40e_vsi_release(pf->vsi[i]);
|
||||
pf->vsi[i] = NULL;
|
||||
}
|
||||
|
||||
/* remove attached clients */
|
||||
if (pf->flags & I40E_FLAG_IWARP_ENABLED) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user