DPDK auxiliary bus first creates a list of known devices in the
`auxiliary_bus.device_list` and then tries to attach a driver to each
device on that list.

If the driver attachment has failed, a device will remain on the list.

The device destruction did not validate driver existence and
crashed.

The patch validates auxiliary device driver before accessing
driver related resources.

Fixes: 1afce3086cf4 ("bus/auxiliary: introduce auxiliary bus")
Cc: sta...@dpdk.org

Signed-off-by: Gregory Etelson <getel...@nvidia.com>
Acked-by: Dariusz Sosnowski <dsosnow...@nvidia.com>
---
 drivers/bus/auxiliary/auxiliary_common.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/bus/auxiliary/auxiliary_common.c 
b/drivers/bus/auxiliary/auxiliary_common.c
index 5c6c6b0ef2..ac766e283e 100644
--- a/drivers/bus/auxiliary/auxiliary_common.c
+++ b/drivers/bus/auxiliary/auxiliary_common.c
@@ -163,6 +163,8 @@ rte_auxiliary_driver_remove_dev(struct rte_auxiliary_device 
*dev)
                return -EINVAL;
 
        drv = dev->driver;
+       if (drv == NULL)
+               return 0;
 
        AUXILIARY_LOG(DEBUG, "Driver %s remove auxiliary device %s on NUMA node 
%i",
                      drv->driver.name, dev->name, dev->device.numa_node);
-- 
2.48.1

Reply via email to