usb: u132-hcd: fix potential NULL pointer dereference
authorKangjie Lu <kjlu@umn.edu>
Tue, 19 Mar 2019 17:34:06 +0000 (12:34 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 26 Mar 2019 07:42:53 +0000 (16:42 +0900)
In case create_singlethread_workqueue fails, the fix notifies
callers the error to avoid potential NULL pointer dereferences.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/host/u132-hcd.c

index 934584f0a20a7bee30adcee141c0a7eb63a51b3f..e29165027e8b58d046aa5a9a826b48e540ffc9b4 100644 (file)
@@ -3203,6 +3203,8 @@ static int __init u132_hcd_init(void)
                return -ENODEV;
        printk(KERN_INFO "driver %s\n", hcd_name);
        workqueue = create_singlethread_workqueue("u132");
+       if (!workqueue)
+               return -ENOMEM;
        retval = platform_driver_register(&u132_platform_driver);
        return retval;
 }