From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E90ADA04A2 for ; Mon, 18 May 2020 07:34:04 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C78B81D53F; Mon, 18 May 2020 07:34:04 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id A6D021D182; Mon, 18 May 2020 07:34:01 +0200 (CEST) IronPort-SDR: 1YsxgOmt5KZRP7rC+3kGTeLhQXa8MCOMoj9JPSkUvywnwiQITqQg6StFfsk4QXw9l/H6eVxvRA ehvWnWFjYWvA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 May 2020 22:34:00 -0700 IronPort-SDR: abB0IrJQJ4i5e5gE3YAa6Ji2wBJB2a60glICs3D/yg+2id1/NeX5K3ObGWkIQNaMmmTnpBB8hW bVGFxwq00/Fw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,406,1583222400"; d="scan'208";a="263839801" Received: from unknown (HELO localhost.localdomain.bj.intel.com) ([172.16.182.123]) by orsmga003.jf.intel.com with ESMTP; 17 May 2020 22:33:58 -0700 From: Wei Zhao To: dev@dpdk.org Cc: stable@dpdk.org, xiaolong.ye@intel.com, jia.guo@intel.com, Wei Zhao Date: Mon, 18 May 2020 13:10:32 +0800 Message-Id: <20200518051032.33365-1-wei.zhao1@intel.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20200512151915.105152-1-wei.zhao1@intel.com> References: <20200512151915.105152-1-wei.zhao1@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] [PATCH v2] net/i40e: fix the core dump risk of wild pointer operation X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 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 Sender: "stable" In i40e PMD code of function i40e_res_pool_free(), if valid_entry is freed by "rte_free(valid_entry);" in the code, then the following code for pool update may still use the wild pointer "valid_entry" for pool info update. It seems has the risk of core dump for using wild pointer operation, we should avoid this risk. Cc: stable@dpdk.org Fixes: 4861cde46116 ("i40e: new poll mode driver") Signed-off-by: Wei Zhao --- v2: update commit log --- drivers/net/i40e/i40e_ethdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 91dcd0ebf..09c2efef8 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -4973,6 +4973,9 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, } insert = 0; + pool->num_free += valid_entry->len; + pool->num_alloc -= valid_entry->len; + /* Try to merge with next one*/ if (next != NULL) { /* Merge with next one */ @@ -5010,9 +5013,6 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, LIST_INSERT_HEAD(&pool->free_list, valid_entry, next); } - pool->num_free += valid_entry->len; - pool->num_alloc -= valid_entry->len; - return 0; } -- 2.17.1