Commit ed7487c2 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman

USB: fix possible null deref in init_usb_class()

Add a missing goto.  We dereference usb_class on the next line.

Found by smatch static checker.
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent a33279df
...@@ -99,6 +99,7 @@ static int init_usb_class(void) ...@@ -99,6 +99,7 @@ static int init_usb_class(void)
printk(KERN_ERR "class_create failed for usb devices\n"); printk(KERN_ERR "class_create failed for usb devices\n");
kfree(usb_class); kfree(usb_class);
usb_class = NULL; usb_class = NULL;
goto exit;
} }
usb_class->class->devnode = usb_devnode; usb_class->class->devnode = usb_devnode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment