patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] net/i40e: fix the security risk of wild pointer operation
@ 2020-05-12 15:19 Wei Zhao
  2020-05-15  2:24 ` Zhao1, Wei
                   ` (2 more replies)
  0 siblings, 3 replies; 12+ messages in thread
From: Wei Zhao @ 2020-05-12 15:19 UTC (permalink / raw)
  To: dev; +Cc: stable, beilei.xing, Wei Zhao

In i40e PMD code of function i40e_res_pool_free(), if valid_entry is
freed by "rte_free(valid_entry);" in the following code:

if (prev != NULL) {
 ........................

   if (insert == 1) {
     LIST_REMOVE(valid_entry, next);
     rte_free(valid_entry);
    } else {
     rte_free(valid_entry);
     insert = 1;
    }
  }

then the following code for pool update may still use the wild pointer
"valid_entry":

" pool->num_free += valid_entry->len;
  pool->num_alloc -= valid_entry>len;
"
it seems to be a security bug, we should avoid this risk.

Cc: stable@dpdk.org
Fixes: 4861cde46116 ("i40e: new poll mode driver")

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
---
 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 749d85f54..7f8ea5309 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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2020-05-19  1:37 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 15:19 [dpdk-stable] [PATCH] net/i40e: fix the security risk of wild pointer operation Wei Zhao
2020-05-15  2:24 ` Zhao1, Wei
2020-05-15  6:32 ` [dpdk-stable] [dpdk-dev] " Jeff Guo
2020-05-15  7:28   ` Ye Xiaolong
2020-05-18  5:24     ` Zhao1, Wei
2020-05-18  5:32       ` Ye Xiaolong
2020-05-18  5:10 ` [dpdk-stable] [PATCH v2] net/i40e: fix the core dump " Wei Zhao
2020-05-18  6:43   ` [dpdk-stable] [PATCH v3] " Wei Zhao
2020-05-18  7:43     ` [dpdk-stable] [PATCH v4] " Wei Zhao
2020-05-18  8:00       ` [dpdk-stable] [PATCH v5] " Wei Zhao
2020-05-18  8:45         ` Jeff Guo
2020-05-19  1:28         ` Ye Xiaolong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).