Skip to content

Commit e33e866

Browse files
Anton Bondarenkogregkh
authored andcommitted
usb: core: fix potential memory leak in error path during hcd creation
commit 1a744d2eb76aaafb997fda004ae3ae62a1538f85 upstream. Free memory allocated for address0_mutex if allocation of bandwidth_mutex failed. Fixes: feb26ac31a2a ("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>
1 parent ec443ee commit e33e866

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/usb/core/hcd.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,7 @@ struct usb_hcd *usb_create_shared_hcd(const struct hc_driver *driver,
25112511
hcd->bandwidth_mutex = kmalloc(sizeof(*hcd->bandwidth_mutex),
25122512
GFP_KERNEL);
25132513
if (!hcd->bandwidth_mutex) {
2514+
kfree(hcd->address0_mutex);
25142515
kfree(hcd);
25152516
dev_dbg(dev, "hcd bandwidth mutex alloc failed\n");
25162517
return NULL;

0 commit comments

Comments
 (0)