Skip to contentSkip to conversation

net/bonding: fix possible null pointer reference

PATCH Applied Declan Doherty 2 participants 2 messages Jan 8, 2019 – Jan 9, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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")
---
 drivers/net/bonding/rte_eth_bond_api.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bonding/rte_eth_bond_api.c +4 -1
index 21bcd5044..e5e146540 100644
@@ -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 */
Signature · 1 line
2.14.5
Applied
#1 lore raw
Quoted 7 lines · Declan Doherty

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")

Applied to dpdk-next-net/master, thanks.