]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
USB: chipidea: prevent access to freed memory
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 22 Nov 2012 08:48:41 +0000 (09:48 +0100)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 22 Nov 2012 08:48:41 +0000 (09:48 +0100)
The pointer to a platform_device struct must not be dereferenced after
the device has been unregistered.

drivers/usb/chipidea/core.c

index f69d029b460716c7fdb233a7da34c9c2bb5ea8aa..b726c49f96196002a55bf76d7ff02eb3d32be2a0 100644 (file)
@@ -385,8 +385,9 @@ EXPORT_SYMBOL_GPL(ci13xxx_add_device);
 
 void ci13xxx_remove_device(struct platform_device *pdev)
 {
+       int id = pdev->id;
        platform_device_unregister(pdev);
-       ida_simple_remove(&ci_ida, pdev->id);
+       ida_simple_remove(&ci_ida, id);
 }
 EXPORT_SYMBOL_GPL(ci13xxx_remove_device);