From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 1795FF6D2; Thu, 12 Jan 2017 14:58:20 +0100 (CET) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP; 12 Jan 2017 05:58:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,349,1477983600"; d="scan'208";a="52196042" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by orsmga005.jf.intel.com with ESMTP; 12 Jan 2017 05:58:19 -0800 From: Bernard Iremonger To: dev@dpdk.org, wenzhuo.lu@intel.com, jingjing.wu@intel.com, helin.zhang@intel.com Cc: Bernard Iremonger , stable@dpdk.org Date: Thu, 12 Jan 2017 13:58:11 +0000 Message-Id: <1484229492-18902-2-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 In-Reply-To: <1483979366-16914-1-git-send-email-bernard.iremonger@intel.com> References: <1483979366-16914-1-git-send-email-bernard.iremonger@intel.com> Subject: [dpdk-dev] [PATCH v3 1/2] net/i40e: fix segmentation fault in close X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Jan 2017 13:58:21 -0000 Change the order of releasing the vsi's. Release the vmdq vsi's first, then release the main vsi. Fixes: 4861cde46116 ("i40e: new poll mode driver") CC: stable@dpdk.org Signed-off-by: Bernard Iremonger --- drivers/net/i40e/i40e_ethdev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f13e61b..e8cfec8 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -2068,18 +2068,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); @@ -4342,6 +4341,9 @@ i40e_vsi_release(struct i40e_vsi *vsi) if (!vsi) return I40E_SUCCESS; + if (!vsi->adapter) + return I40E_ERR_BAD_PTR; + user_param = vsi->user_param; pf = I40E_VSI_TO_PF(vsi); -- 2.10.1