From e6b8757bb72caa565d24282ad8e405f28e3a34a9 Mon Sep 17 00:00:00 2001 From: Declan Doherty Date: Tue, 8 Jan 2019 11:17:56 +0000 Subject: [PATCH] net/bonding: fix possible null pointer reference In function check_for_bonded_ethdev the driver name is used without validating the pointer references in the passed ethdev object. Fixes: 740feaf349b1 ("ethdev: remove driver name from device private data") Cc: stable@dpdk.org Signed-off-by: Declan Doherty --- drivers/net/bonding/rte_eth_bond_api.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c index 21bcd5044c..e5e1465402 100644 --- a/drivers/net/bonding/rte_eth_bond_api.c +++ b/drivers/net/bonding/rte_eth_bond_api.c @@ -19,7 +19,10 @@ int check_for_bonded_ethdev(const struct rte_eth_dev *eth_dev) { /* Check valid pointer */ - if (eth_dev->device->driver->name == NULL) + if (eth_dev == NULL || + eth_dev->device == NULL || + eth_dev->device->driver == NULL || + eth_dev->device->driver->name == NULL) return -1; /* return 0 if driver name matches */ -- 2.20.1