mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-05-30 19:15:41 +00:00
usb: core: fix potential memory leak in error path during hcd creation
Free memory allocated for address0_mutex if allocation of bandwidth_mutex
failed.
Fixes: feb26ac31a
("usb: core: hub: hub_port_init lock controller instead of bus")
Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@gmail.com>
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
dd5ca753fa
commit
1a744d2eb7
1 changed files with 1 additions and 0 deletions
|
@ -2520,6 +2520,7 @@ struct usb_hcd *__usb_create_hcd(const struct hc_driver *driver,
|
|||
hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex),
|
||||
GFP_KERNEL);
|
||||
if (!hcd->bandwidth_mutex) {
|
||||
kfree(hcd->address0_mutex);
|
||||
kfree(hcd);
|
||||
dev_dbg(dev, "hcd bandwidth mutex alloc failed\n");
|
||||
return NULL;
|
||||
|
|
Loading…
Add table
Reference in a new issue