[dpdk-stable] patch 'ethdev: fix crash on owner delete' has been queued to stable release 20.11.4

Xueming Li xuemingl at nvidia.com
Wed Nov 10 07:32:03 CET 2021


Hi,

FYI, your patch has been queued to stable release 20.11.4

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet.
It will be pushed if I get no objections before 11/12/21. 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/steevenlee/dpdk

This queued commit can be viewed at:
https://github.com/steevenlee/dpdk/commit/ffe143c3a8ee84139231095668462f5051d38a79

Thanks.

Xueming Li <xuemingl at nvidia.com>

---
>From ffe143c3a8ee84139231095668462f5051d38a79 Mon Sep 17 00:00:00 2001
From: Ferruh Yigit <ferruh.yigit at intel.com>
Date: Thu, 4 Nov 2021 11:04:21 +0000
Subject: [PATCH] ethdev: fix crash on owner delete
Cc: Xueming Li <xuemingl at nvidia.com>

[ upstream commit b7ade5d31a747fc044a9816b38814b47a6e1b201 ]

'eth_dev->data' can be null before ethdev allocated. The API walks
through all eth devices, at least for some data can be null.

Adding 'eth_dev->data' null check before accessing it.

Fixes: 33c73aae32e4 ("ethdev: allow ownership operations on unused port")

Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
Acked-by: Chenbo Xia <chenbo.xia at intel.com>
Acked-by: Thomas Monjalon <thomas at monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko at oktetlabs.ru>
---
 lib/librte_ethdev/rte_ethdev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
index 9b695e1e1b..dd5ce4eb1a 100644
--- a/lib/librte_ethdev/rte_ethdev.c
+++ b/lib/librte_ethdev/rte_ethdev.c
@@ -718,10 +718,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
 	rte_spinlock_lock(&eth_dev_shared_data->ownership_lock);
 
 	if (eth_is_valid_owner_id(owner_id)) {
-		for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++)
-			if (rte_eth_devices[port_id].data->owner.id == owner_id)
-				memset(&rte_eth_devices[port_id].data->owner, 0,
+		for (port_id = 0; port_id < RTE_MAX_ETHPORTS; port_id++) {
+			struct rte_eth_dev_data *data =
+				rte_eth_devices[port_id].data;
+			if (data != NULL && data->owner.id == owner_id)
+				memset(&data->owner, 0,
 				       sizeof(struct rte_eth_dev_owner));
+		}
 		RTE_ETHDEV_LOG(NOTICE,
 			"All port owners owned by %016"PRIx64" identifier have removed\n",
 			owner_id);
-- 
2.33.0

---
  Diff of the applied patch vs upstream commit (please double-check if non-empty:
---
--- -	2021-11-10 14:17:12.420618591 +0800
+++ 0239-ethdev-fix-crash-on-owner-delete.patch	2021-11-10 14:17:02.080744373 +0800
@@ -1 +1 @@
-From b7ade5d31a747fc044a9816b38814b47a6e1b201 Mon Sep 17 00:00:00 2001
+From ffe143c3a8ee84139231095668462f5051d38a79 Mon Sep 17 00:00:00 2001
@@ -4,0 +5,3 @@
+Cc: Xueming Li <xuemingl at nvidia.com>
+
+[ upstream commit b7ade5d31a747fc044a9816b38814b47a6e1b201 ]
@@ -12 +14,0 @@
-Cc: stable at dpdk.org
@@ -19 +21 @@
- lib/ethdev/rte_ethdev.c | 9 ++++++---
+ lib/librte_ethdev/rte_ethdev.c | 9 ++++++---
@@ -22,5 +24,5 @@
-diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c
-index 7db84b12d0..8e679e4003 100644
---- a/lib/ethdev/rte_ethdev.c
-+++ b/lib/ethdev/rte_ethdev.c
-@@ -757,10 +757,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)
+diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c
+index 9b695e1e1b..dd5ce4eb1a 100644
+--- a/lib/librte_ethdev/rte_ethdev.c
++++ b/lib/librte_ethdev/rte_ethdev.c
+@@ -718,10 +718,13 @@ rte_eth_dev_owner_delete(const uint64_t owner_id)


More information about the stable mailing list