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 A7AA84296F for ; Mon, 17 Apr 2023 16:51:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A031742B8E; Mon, 17 Apr 2023 16:51:35 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by mails.dpdk.org (Postfix) with ESMTP id 015D240698; Mon, 17 Apr 2023 16:51:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681743093; x=1713279093; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=eEvDwz657KOSoXo0U/CSyQG32QyLdkZ9OSQ62n46YTY=; b=ewzfJhiM/cIsH5Bw0F8J3hTYCEIm4vHvoB/gjyk0J6k+fV8ytorK4+B5 uDjWTAZ6B5Ea1WO7b7I8t2HA87a7ewVhR4umXKab0ToUSR8StR0FDMHpJ MHK7BKAMwMnYyB5Y3ewcXE9fXJN1ertv30xQbkVDN6nUh3sHhK7/e/vVS VZ63z7E73JfFG8TIZintu4SJsNeIM29tKiGWjzT4TXlV9L+W0mEcOgZpo D0UFilMPamrrYTAySxWG2tcGJtl4/QdcJhrGSZxXanGTNkGZPyUJkS+27 +mo3LeaEatPtjxnh4RHRm3aX5bbHXfKr1WP2xr4dehLMkalC0RN6AXHmB Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="343662548" X-IronPort-AV: E=Sophos;i="5.99,204,1677571200"; d="scan'208";a="343662548" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Apr 2023 07:51:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10683"; a="814831009" X-IronPort-AV: E=Sophos;i="5.99,204,1677571200"; d="scan'208";a="814831009" Received: from wp-ena2.iind.intel.com ([10.190.189.155]) by orsmga004.jf.intel.com with ESMTP; 17 Apr 2023 07:51:30 -0700 From: Kamalakannan R To: dev@dpdk.org Cc: harshad.suresh.narayane@intel.com, kamalakannan R , stable@dpdk.org, Cristian Dumitrescu Subject: [PATCH v2] pipeline: fix double free error for table stats Date: Mon, 17 Apr 2023 12:44:30 +0530 Message-Id: <20230417071430.724019-1-kamalakannan.r@intel.com> X-Mailer: git-send-email 2.34.3 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org From: kamalakannan R The pointer to the table statistics data structure needs to be set to NULL after free inside the table_build_free(), as this function is called from multiple places, leading to double memory free error. Similar fix for the learner_build_free() function. Fixes: 742b0a57f50 ("pipeline: add table statistics to SWX") Fixes: 4f59d372614 ("pipeline: support learner tables") Cc: stable@dpdk.org Signed-off-by: Kamalakannan R Acked-by: Cristian Dumitrescu --- lib/pipeline/rte_swx_pipeline.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/pipeline/rte_swx_pipeline.c b/lib/pipeline/rte_swx_pipeline.c index dea1378095..da37eda231 100644 --- a/lib/pipeline/rte_swx_pipeline.c +++ b/lib/pipeline/rte_swx_pipeline.c @@ -8665,6 +8665,7 @@ table_build_free(struct rte_swx_pipeline *p) free(p->table_stats[i].n_pkts_action); free(p->table_stats); + p->table_stats = NULL; } } @@ -9579,6 +9580,7 @@ learner_build_free(struct rte_swx_pipeline *p) free(p->learner_stats[i].n_pkts_action); free(p->learner_stats); + p->learner_stats = NULL; } } -- 2.34.3