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 8FB55A04A3 for ; Fri, 5 Jun 2020 20:27:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 862F11D515; Fri, 5 Jun 2020 20:27:49 +0200 (CEST) Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by dpdk.org (Postfix) with ESMTP id 354C11D525 for ; Fri, 5 Jun 2020 20:27:48 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1591381667; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QP9zqzVHOApFYwNvl4F3RKgAt74UERwCSHmja1qOqn0=; b=Zp9udRQm+OC2QoJNMPmo3OhObs6IH/N41twsgUxKRrL1re0+oGo6jucKrd6g3hfvYoCfyZ hRKEpSSzGMUYu+SDGvZeKwM98mK9oq8u7/bGplAxI4zA7CUlYOUZqh5JTnvxP2XfpwFuTE huukIFQv8zRHjog/Akdx1JnVf/8GgxM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-133-_pnd4RguMeiRKPDB6HIpdQ-1; Fri, 05 Jun 2020 14:27:44 -0400 X-MC-Unique: _pnd4RguMeiRKPDB6HIpdQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDBE1DC28; Fri, 5 Jun 2020 18:27:42 +0000 (UTC) Received: from rh.redhat.com (unknown [10.33.36.130]) by smtp.corp.redhat.com (Postfix) with ESMTP id D1B4660C47; Fri, 5 Jun 2020 18:27:41 +0000 (UTC) From: Kevin Traynor To: Wei Zhao Cc: Jeff Guo , Xiaolong Ye , dpdk stable Date: Fri, 5 Jun 2020 19:25:09 +0100 Message-Id: <20200605182525.22483-72-ktraynor@redhat.com> In-Reply-To: <20200605182525.22483-1-ktraynor@redhat.com> References: <20200605182525.22483-1-ktraynor@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 8bit Subject: [dpdk-stable] patch 'net/i40e: fix wild pointer' has been queued to LTS release 18.11.9 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" Hi, FYI, your patch has been queued to LTS release 18.11.9 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 06/10/20. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/d820e970512a5ad89039b27bcf2a17542777d678 Thanks. Kevin. --- >From d820e970512a5ad89039b27bcf2a17542777d678 Mon Sep 17 00:00:00 2001 From: Wei Zhao Date: Mon, 18 May 2020 16:00:51 +0800 Subject: [PATCH] net/i40e: fix wild pointer [ upstream commit b342fd9084cf99292f0077e16b0edb3b6b79f6e7 ] 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. Fixes: 4861cde46116 ("i40e: new poll mode driver") Signed-off-by: Wei Zhao Reviewed-by: Jeff Guo Reviewed-by: Xiaolong Ye --- drivers/net/i40e/i40e_ethdev.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index f312abed27..fb7b489296 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -4807,4 +4807,5 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, struct pool_entry *entry, *next, *prev, *valid_entry = NULL; uint32_t pool_offset; + uint16_t len; int insert; @@ -4845,10 +4846,11 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, insert = 0; + len = valid_entry->len; /* Try to merge with next one*/ if (next != NULL) { /* Merge with next one */ - if (valid_entry->base + valid_entry->len == next->base) { + if (valid_entry->base + len == next->base) { next->base = valid_entry->base; - next->len += valid_entry->len; + next->len += len; rte_free(valid_entry); valid_entry = next; @@ -4860,11 +4862,13 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, /* Merge with previous one */ if (prev->base + prev->len == valid_entry->base) { - prev->len += valid_entry->len; + prev->len += len; /* If it merge with next one, remove next node */ if (insert == 1) { LIST_REMOVE(valid_entry, next); rte_free(valid_entry); + valid_entry = NULL; } else { rte_free(valid_entry); + valid_entry = NULL; insert = 1; } @@ -4882,6 +4886,6 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, } - pool->num_free += valid_entry->len; - pool->num_alloc -= valid_entry->len; + pool->num_free += len; + pool->num_alloc -= len; return 0; -- 2.21.3 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2020-06-05 19:20:54.764114488 +0100 +++ 0072-net-i40e-fix-wild-pointer.patch 2020-06-05 19:20:50.957037474 +0100 @@ -1 +1 @@ -From b342fd9084cf99292f0077e16b0edb3b6b79f6e7 Mon Sep 17 00:00:00 2001 +From d820e970512a5ad89039b27bcf2a17542777d678 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit b342fd9084cf99292f0077e16b0edb3b6b79f6e7 ] + @@ -13 +14,0 @@ -Cc: stable@dpdk.org @@ -23 +24 @@ -index 91dcd0ebf0..c68fba125e 100644 +index f312abed27..fb7b489296 100644 @@ -26 +27 @@ -@@ -4936,4 +4936,5 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, +@@ -4807,4 +4807,5 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, @@ -32 +33 @@ -@@ -4974,10 +4975,11 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, +@@ -4845,10 +4846,11 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, @@ -46 +47 @@ -@@ -4989,11 +4991,13 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, +@@ -4860,11 +4862,13 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, @@ -61 +62 @@ -@@ -5011,6 +5015,6 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool, +@@ -4882,6 +4886,6 @@ i40e_res_pool_free(struct i40e_res_pool_info *pool,