From: Lothar Waßmann Date: Thu, 22 Nov 2012 09:11:25 +0000 (+0100) Subject: USB: chipidea: fix use after free bug X-Git-Tag: v3.7.2~94 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8af66623ab9c6d0c8b1517d578f7f3ad1e323cc9;p=thirdparty%2Fkernel%2Fstable.git USB: chipidea: fix use after free bug commit 98c35534420d3147553bd3071a5fc63cd56de5b1 upstream. The pointer to a platform_device struct must not be dereferenced after the device has been unregistered. This bug produces a crash when unloading the ci13xxx kernel module compiled with CONFIG_PAGE_POISONING enabled. Signed-off-by: Lothar Waßmann Acked-by: Alexander Shishkin Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index f69d029b46071..b726c49f96196 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -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);