From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id A1255A00BE; Thu, 17 Feb 2022 11:34:56 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 024D54114E; Thu, 17 Feb 2022 11:34:53 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mails.dpdk.org (Postfix) with ESMTP id 3854140DDD for ; Thu, 17 Feb 2022 11:34:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1645094091; x=1676630091; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZsjXsbhx2Gs+bw9YsKG42P57qwcr5pQ/MkuCdGma64Q=; b=df9RbXHMmfOBbDQOslk9vrNSWjvAwEC5sDNq3DprK1tr13S87iuxqUGZ zv1TWokskqSwS1elqTOq6TQSfFX3CUaDom42lvwikt3kSEfauj7xBbdxr EkDzUrEBT+4WSa2eQtybSyI84XtLqD9Nq0mHNZjeRJ4JYvW1KAlSJ6Nde gTa9rKIFZ7vmFGqUA89/tbKHN9qA+SamuMuiRncOsCwVgk8BOcj+RV/D3 pk+M38983FLC9/H9Yq8rc+qTFq856sG0n/X4szNJyy6SMRoHrbpkHloC4 m6q+Iipr+F9dYuO33NtzdnLv8SK3cYn4x0EinWrauTtV1yJTzALLPTLX7 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10260"; a="314114273" X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="314114273" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 02:34:48 -0800 X-IronPort-AV: E=Sophos;i="5.88,375,1635231600"; d="scan'208";a="545514017" Received: from unknown (HELO localhost.localdomain) ([10.239.251.3]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Feb 2022 02:34:44 -0800 From: wenxuanx.wu@intel.com To: qiming.yang@intel.com, qi.z.zhang@intel.com, xiaoyun.li@intel.com, aman.deep.singh@intel.com, yuying.zhang@intel.com Cc: dev@dpdk.org Subject: [PATCH 1/2] app/testpmd: fix quit testpmd with vfs and pf Date: Thu, 17 Feb 2022 18:14:27 +0800 Message-Id: <20220217101428.385751-2-wenxuanx.wu@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220217101428.385751-1-wenxuanx.wu@intel.com> References: <20220217101428.385751-1-wenxuanx.wu@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: wenxuan wu When testpmd startups with pf and vfs,this error occurs when quitting, results in pf is released before vfs ,so the vf would access an freed heap memory. The solution is that release our allocated ports in reverse order,add two macros RTE_ETH_FOREACH_DEV_REVERSE_OWNED_BY and RTE_ETH_FOREACH_DEV_REVERSE,which would be used in quit procedure of testpmd, error is fixed. Fixes: d3a274ce9dee ("app/testpmd: handle SIGINT and SIGTERM") Cc: stable@dpdk.org Signed-off-by: wenxuan wu --- app/test-pmd/testpmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index e1da961311..698b6d8cc4 100644 --- a/app/test-pmd/testpmd.c +++ b/app/test-pmd/testpmd.c @@ -3384,12 +3384,12 @@ pmd_test_exit(void) #endif if (ports != NULL) { no_link_check = 1; - RTE_ETH_FOREACH_DEV(pt_id) { + RTE_ETH_FOREACH_DEV_REVERSE(pt_id) { printf("\nStopping port %d...\n", pt_id); fflush(stdout); stop_port(pt_id); } - RTE_ETH_FOREACH_DEV(pt_id) { + RTE_ETH_FOREACH_DEV_REVERSE(pt_id) { printf("\nShutting down port %d...\n", pt_id); fflush(stdout); close_port(pt_id); -- 2.25.1