net/i40e: fix crash in close

Change the order of releasing the VSI's.
Release the VMDq VSI's first, then release the main VSI.

Fixes: 3cb446b4ae ("i40e: free vmdq vsi when closing")
Cc: stable@dpdk.org

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
This commit is contained in:
Bernard Iremonger 2017-01-27 10:22:47 +00:00 committed by Ferruh Yigit
parent bbab3d97c3
commit 7041dc95c0

View File

@ -1,7 +1,7 @@
/*-
* BSD LICENSE
*
* Copyright(c) 2010-2016 Intel Corporation. All rights reserved.
* Copyright(c) 2010-2017 Intel Corporation. All rights reserved.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@ -2072,18 +2072,17 @@ i40e_dev_close(struct rte_eth_dev *dev)
/* shutdown and destroy the HMC */
i40e_shutdown_lan_hmc(hw);
/* release all the existing VSIs and VEBs */
i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);
for (i = 0; i < pf->nb_cfg_vmdq_vsi; i++) {
i40e_vsi_release(pf->vmdq[i].vsi);
pf->vmdq[i].vsi = NULL;
}
rte_free(pf->vmdq);
pf->vmdq = NULL;
/* release all the existing VSIs and VEBs */
i40e_fdir_teardown(pf);
i40e_vsi_release(pf->main_vsi);
/* shutdown the adminq */
i40e_aq_queue_shutdown(hw, true);
i40e_shutdown_adminq(hw);
@ -4374,6 +4373,9 @@ i40e_vsi_release(struct i40e_vsi *vsi)
if (!vsi)
return I40E_SUCCESS;
if (!vsi->adapter)
return -EFAULT;
user_param = vsi->user_param;
pf = I40E_VSI_TO_PF(vsi);