numam-dpdk/drivers/bus/vdev
Zhangfei Gao 3f27defe0c bus/vdev: fix crash in device cleanup
vdev_probe calls driver->probe and set dev->device.driver,
which will be NULL if the probe fails.

In vdev_cleanup, drv = container_of(dev->device.driver)
drv will be !NULL in this case, causing drv->remove
Segmentation fault.

Fixed by checking dev->device.driver before.

Log:
$ sudo dpdk-test --vdev=crypto_uadk --log-level=6
vdev_probe(): failed to initialize crypto_uadk device
EAL: Bus (vdev) probe failed.
RTE>>quit
Segmentation fault

Fixes: 1cab1a40ea ("bus: cleanup devices on shutdown")

Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2022-10-20 11:35:07 +02:00
..
bus_vdev_driver.h dev: hide driver object 2022-09-23 16:14:34 +02:00
meson.build bus/vdev: make driver-only headers private 2022-09-23 16:14:34 +02:00
rte_bus_vdev.h bus/vdev: make driver-only headers private 2022-09-23 16:14:34 +02:00
vdev_logs.h drivers: use SPDX tag for Intel copyright files 2018-01-04 22:41:39 +01:00
vdev_params.c dev: hide driver object 2022-09-23 16:14:34 +02:00
vdev_private.h eal: make OS shims internal 2021-04-15 01:56:20 +02:00
vdev.c bus/vdev: fix crash in device cleanup 2022-10-20 11:35:07 +02:00
version.map bus/vdev: make driver-only headers private 2022-09-23 16:14:34 +02:00