[dpdk-stable] patch 'ethdev: fix port lookup if none' has been queued to stable release 16.11.1

Yuanhan Liu yuanhan.liu at linux.intel.com
Mon Jan 23 08:46:40 CET 2017


Hi,

FYI, your patch has been queued to stable release 16.11.1

Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable
yet. It will be pushed if I get no objections before 01/28/17.
So please shout if anyone has objections.

---

Note 16.11 is a LTS release. v16.11.1 is planned to be released
shortly (about 2-3 weeks) after v17.02.

---

Thanks.

	--yliu

---
>From d384e2694e1f61cb08fc8c96d4faef7755ab8e9c Mon Sep 17 00:00:00 2001
From: Anatoly Burakov <anatoly.burakov at intel.com>
Date: Sat, 19 Nov 2016 13:10:11 +0000
Subject: [PATCH] ethdev: fix port lookup if none

[ upstream commit f9ae888b1e19face2ce02e92936f793499c11956 ]

Aside from avoiding doing useless work, this also fixes a segfault
when calling rte_eth_dev_get_port_by_name() whenever no devices
were found yet, and therefore rte_eth_dev_data wasn't yet allocated.

Fixes: 9c5b8d8b9feb ("ethdev: clean port id retrieval when attaching")

Signed-off-by: Anatoly Burakov <anatoly.burakov at intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon at 6wind.com>
---
 lib/librte_ether/rte_ethdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.c
index 4209ad0..1e0f206 100644
--- a/lib/librte_ether/rte_ethdev.c
+++ b/lib/librte_ether/rte_ethdev.c
@@ -376,6 +376,9 @@ rte_eth_dev_get_port_by_name(const char *name, uint8_t *port_id)
 		return -EINVAL;
 	}
 
+	if (!nb_ports)
+		return -ENODEV;
+
 	*port_id = RTE_MAX_ETHPORTS;
 
 	for (i = 0; i < RTE_MAX_ETHPORTS; i++) {
-- 
1.9.0



More information about the stable mailing list