Skip to contentSkip to conversation

app/testpmd: fix crash when doing port info of vdev

PATCH In review Stephen Hemminger 3 participants 4 messages Feb 16, 2019 – Apr 9, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 app/testpmd: fix crash when doing port info of vdev

From: Stephen Hemminger <[email protected]>

Noticed a SEGV in testpmd doing:

Quoted 1 line

show port info 1

on Hyper-V with failsafe/tap PMD.

A vdev may not have an associated device (i.e NULL) and therefore testpmd should skip devargs in that case.

Fixes cf72ed09181b ("app/testpmd: display devargs in port info output")
---
 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c +2 -1
index b9e5dd923b0f..38708db943d2 100644
@@ -415,7 +415,8 @@ port_infos_display(portid_t port_id)
 	rte_eth_dev_get_name_by_port(port_id, name);
 	printf("\nDevice name: %s", name);
 	printf("\nDriver name: %s", dev_info.driver_name);
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
+	if (dev_info.device && dev_info.device->devargs &&
+	    dev_info.device->devargs->args)
 		printf("\nDevargs: %s", dev_info.device->devargs->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 39 lines

-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Stephen Hemminger
Sent: Saturday, February 16, 2019 9:37 AM
To: [email protected]
Cc: [email protected]; Stephen Hemminger <[email protected]>
Subject: [dpdk-dev] [PATCH] app/testpmd: fix crash when doing port info of vdev

From: Stephen Hemminger <[email protected]>

Noticed a SEGV in testpmd doing:

Quoted 1 line

show port info 1

on Hyper-V with failsafe/tap PMD.

A vdev may not have an associated device (i.e NULL) and therefore testpmd should skip devargs in that case.

Fixes cf72ed09181b ("app/testpmd: display devargs in port info output")
---
 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c +2 -2
index b9e5dd923b0f..38708db943d2 100644
@@ -415,7 +415,8 @@ port_infos_display(portid_t port_id)
 	rte_eth_dev_get_name_by_port(port_id, name);
 	printf("\nDevice name: %s", name);
 	printf("\nDriver name: %s", dev_info.driver_name);
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
+	if (dev_info.device && dev_info.device->devargs &&
+	    dev_info.device->devargs->args)
 		printf("\nDevargs: %s", dev_info.device->devargs->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
--
Quoted 1 line

2.17.1

Thanks
Jingjing

#2 lore raw
In reply to Stephen Hemminger
Quoted 20 lines · Stephen Hemminger

From: Stephen Hemminger <[email protected]>

Noticed a SEGV in testpmd doing:

Quoted 1 line

show port info 1

on Hyper-V with failsafe/tap PMD.

A vdev may not have an associated device (i.e NULL) and therefore testpmd should skip devargs in that case.

Fixes cf72ed09181b ("app/testpmd: display devargs in port info output")
---
 app/test-pmd/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
app/test-pmd/config.c +0 -0
index b9e5dd923b0f..38708db943d2 100644

app/test-pmd/config.c port_infos_display(portid_t port_id) · line 419

Quoted 6 lines
app/test-pmd/config.c +2 -1
@@ -415,7 +415,8 @@ port_infos_display(portid_t port_id)
 	rte_eth_dev_get_name_by_port(port_id, name);
 	printf("\nDevice name: %s", name);
 	printf("\nDriver name: %s", dev_info.driver_name);
-	if (dev_info.device->devargs && dev_info.device->devargs->args)
+	if (dev_info.device && dev_info.device->devargs &&
+	    dev_info.device->devargs->args)

This means 'eth_dev->device' is NULL. Why the 'device' is NULL for eth_dev? Is there anything to fix in the PMD?

Quoted 4 lines
app/test-pmd/config.c +0 -0
 		printf("\nDevargs: %s", dev_info.device->devargs->args);
 	printf("\nConnect to socket: %u", port->socket_id);
 
#3 lore raw
In reply to Stephen Hemminger
Quoted 11 lines · On Fri, 15 Feb 2019 17:36:46 -0800 Stephen Hemminger…

From: Stephen Hemminger <[email protected]>

Noticed a SEGV in testpmd doing:

Quoted 1 line

show port info 1

on Hyper-V with failsafe/tap PMD.

A vdev may not have an associated device (i.e NULL) and therefore testpmd should skip devargs in that case.

Fixes cf72ed09181b ("app/testpmd: display devargs in port info output")

Can not reproduce with 19.05-rc1