bus/platform: fix use after free
Checks
Commit Message
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 <tduszynski@marvell.com>
---
drivers/bus/platform/platform.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Comments
On Thu, Aug 24, 2023 at 12:52 PM Tomasz Duszynski
<tduszynski@marvell.com> wrote:
>
> 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 <tduszynski@marvell.com>
Applied, thanks.
@@ -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;