patch "usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten" added to usb-testing
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten
to my usb git tree which can be found at
git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git
in the usb-testing branch.
The patch will show up in the next release of the linux-next tree (usually sometime within the next 24 hours during the week.)
The patch will be merged to the usb-next branch sometime soon, after it passes testing, and the merge window is open.
If you have any questions about this process, please let me know.
Quoted 1 line
From
55a9300cea58007741f7d6b4b132e37d84a4329eMon Sep 17 00:00:00 2001
From: "Shuah Khan (Samsung OSG)" <[email protected]>
Date: Thu, 18 Oct 2018 10:19:29 -0600
Subject: usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten
In rmmod path, usbip_vudc does platform_device_put() twice once from platform_device_unregister() and then from put_vudc_device().
The second put results in:
BUG kmalloc-2048 (Not tainted): Poison overwritten error or
BUG: KASAN: use-after-free in kobject_put+0x1e/0x230 if KASAN is
enabled.
[ 169.042156] calling init+0x0/0x1000 [usbip_vudc] @ 1697 [ 169.042396] ============================================================================= [ 169.043678] probe of usbip-vudc.0 returned 1 after 350 usecs [ 169.044508] BUG kmalloc-2048 (Not tainted): Poison overwritten [ 169.044509] ----------------------------------------------------------------------------- ... [ 169.057849] INFO: Freed in device_release+0x2b/0x80 age=4223 cpu=3 pid=1693 [ 169.057852] kobject_put+0x86/0x1b0 [ 169.057853] 0xffffffffc0c30a96 [ 169.057855] __x64_sys_delete_module+0x157/0x240
Fix it to call platform_device_del() instead and let put_vudc_device() do the platform_device_put().
--- drivers/usb/usbip/vudc_main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/usb/usbip/vudc_main.c +9 -1
@@ -73,6 +73,10 @@ static int __init init(void) cleanup:list_for_each_entry_safe (udc_dev, udc_dev2, &vudc_devices, dev_entry) {list_del (&udc_dev->dev_entry); +/* +* Just do platform_device_del() here, put_vudc_device() +* calls the platform_device_put() +*/ platform_device_del (udc_dev->pdev);put_vudc_device (udc_dev); }
@@ -89,7 +93,11 @@ static void __exit cleanup(void)list_for_each_entry_safe (udc_dev, udc_dev2, &vudc_devices, dev_entry) {list_del (&udc_dev->dev_entry); -platform_device_unregister (udc_dev->pdev); +/* +* Just do platform_device_del() here, put_vudc_device() +* calls the platform_device_put() +*/ +platform_device_del (udc_dev->pdev);put_vudc_device (udc_dev); }platform_driver_unregister (&vudc_driver);
Signature · 1 line
2.19.1