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: Jerome Marchand <jmarchan@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        int i;
 
        if (pdev) {
+               device_remove_properties(&pdev->dev);
                device_del(&pdev->dev);
 
                if (pdev->id_auto) {
                        if (r->parent)
                                release_resource(r);
                }
-
-               device_remove_properties(&pdev->dev);
        }
 }
 EXPORT_SYMBOL_GPL(platform_device_del);