[dpdk-stable] patch 'net/i40e: fix wild pointer' has been queued to LTS release 18.11.9

Kevin Traynor ktraynor at redhat.com
Fri Jun 5 20:25:09 CEST 2020


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 <wei.zhao1 at intel.com>
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 <wei.zhao1 at intel.com>
Reviewed-by: Jeff Guo <jia.guo at intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye at intel.com>
---
 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 at 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,



More information about the stable mailing list