[dpdk-dev,2/2] net/ixgbe: fix segfault while devarg parsing

Message ID 20180426231647.239502-2-ferruh.yigit@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply patch file failure

Commit Message

Ferruh Yigit April 26, 2018, 11:16 p.m. UTC
  device.devargs can be null, don't access device.devargs->args without
null check.

Fixes: 3be5d686539c ("net/ixgbe: add support for representor ports")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
Cc: declan.doherty@intel.com
---
 drivers/net/ixgbe/ixgbe_ethdev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
  

Patch

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 15686da10..6088c7e48 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -1729,9 +1729,12 @@  eth_ixgbe_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	struct rte_eth_devargs eth_da;
 	int i, retval;
 
-	retval = rte_eth_devargs_parse(pci_dev->device.devargs->args, &eth_da);
-	if (retval)
-		return retval;
+	if (pci_dev->device.devargs) {
+		retval = rte_eth_devargs_parse(pci_dev->device.devargs->args,
+				&eth_da);
+		if (retval)
+			return retval;
+	}
 
 	/* physical port net_bdf_port */
 	snprintf(name, sizeof(name), "net_%s_%d", pci_dev->device.name, 0);