Commit c90aab9c authored by Jerome Marchand's avatar Jerome Marchand Committed by Greg Kroah-Hartman

platform driver: fix use-after-free in platform_device_del()

In platform_device_del(), the device is still used after a call to
device_del(). At this point there is no guarantee that the device is
still there and there could be a use-after-free access. Move the
call to device_remove_properties() before device_del() to fix that.
Signed-off-by: default avatarJerome Marchand <jmarchan@redhat.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent bea5b158
...@@ -434,6 +434,7 @@ void platform_device_del(struct platform_device *pdev) ...@@ -434,6 +434,7 @@ void platform_device_del(struct platform_device *pdev)
int i; int i;
if (pdev) { if (pdev) {
device_remove_properties(&pdev->dev);
device_del(&pdev->dev); device_del(&pdev->dev);
if (pdev->id_auto) { if (pdev->id_auto) {
...@@ -446,8 +447,6 @@ void platform_device_del(struct platform_device *pdev) ...@@ -446,8 +447,6 @@ void platform_device_del(struct platform_device *pdev)
if (r->parent) if (r->parent)
release_resource(r); release_resource(r);
} }
device_remove_properties(&pdev->dev);
} }
} }
EXPORT_SYMBOL_GPL(platform_device_del); EXPORT_SYMBOL_GPL(platform_device_del);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment