Skip to contentSkip to conversation

bus/platform: fix use after free

PATCH Applied Tomasz Duszynski 2 participants 2 messages Aug 24, 2023 – Oct 2, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bus/platform: fix use after free

Remove device from the list before doing actual cleanup to avoid use after free.

Bugzilla ID: 1276

Fixes 17c839f74da3 ("bus: add platform bus")
---
 drivers/bus/platform/platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/platform/platform.c +1 -1
index 9b6ed2832e..7e24bb96a1 100644
@@ -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;
Signature · 1 line
2.34.1
#1 lore raw
Quoted 8 lines · Tomasz Duszynski

Remove device from the list before doing actual cleanup to avoid use after free.

Bugzilla ID: 1276

Fixes 17c839f74da3 ("bus: add platform bus")

Applied, thanks.

Signature · 1 line
David Marchand