From patchwork Fri Jan 27 10:22:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Iremonger, Bernard" X-Patchwork-Id: 20015 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 69960B6D; Fri, 27 Jan 2017 11:22:55 +0100 (CET) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id A7F8C201; Fri, 27 Jan 2017 11:22:53 +0100 (CET) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP; 27 Jan 2017 02:22:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,294,1477983600"; d="scan'208";a="813968074" Received: from sivswdev01.ir.intel.com (HELO localhost.localdomain) ([10.237.217.45]) by FMSMGA003.fm.intel.com with ESMTP; 27 Jan 2017 02:22:51 -0800 From: Bernard Iremonger To: dev@dpdk.org, jingjing.wu@intel.com Cc: Bernard Iremonger , stable@dpdk.org Date: Fri, 27 Jan 2017 10:22:47 +0000 Message-Id: <1485512567-16668-1-git-send-email-bernard.iremonger@intel.com> X-Mailer: git-send-email 1.7.0.7 Subject: [dpdk-dev] [PATCH v6 1/3] 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 Acked-by: Jingjing Wu --- Changes in v6: Rebased to latest dpdk-next-net This was previously part of a patchset with testpmd patches. Sending seperately as the testpmd patches have not been acked yet. drivers/net/i40e/i40e_ethdev.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index a818998..0937dc4 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -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);