Remove device from the list before doing actual cleanup to avoid use after free.
Bugzilla ID: 1276 Fixes: 17c839f74da3 ("bus: add platform bus") Signed-off-by: Tomasz Duszynski <tduszyn...@marvell.com> --- drivers/bus/platform/platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/bus/platform/platform.c b/drivers/bus/platform/platform.c index 9b6ed2832e..7e24bb96a1 100644 --- a/drivers/bus/platform/platform.c +++ b/drivers/bus/platform/platform.c @@ -617,8 +617,8 @@ platform_bus_cleanup(void) struct rte_platform_device *pdev, *tmp; RTE_TAILQ_FOREACH_SAFE(pdev, &platform_bus.device_list, next, tmp) { - platform_bus_unplug(&pdev->device); TAILQ_REMOVE(&platform_bus.device_list, pdev, next); + platform_bus_unplug(&pdev->device); } return 0; -- 2.34.1