summaryrefslogtreecommitdiff
path: root/drivers/usb/core/hcd.c
diff options
context:
space:
mode:
authorAnton Bondarenko <anton.bondarenko.sama@gmail.com>2017-05-07 01:53:46 +0200
committerSasha Levin <alexander.levin@verizon.com>2017-06-25 22:02:22 -0400
commitbdc69cc86e019bff77be00fbdcb28273dc369428 (patch)
treea60a15be4cb4ca691870d5bc1747443d85747200 /drivers/usb/core/hcd.c
parent11f00c7e1194329d35e3605df18c43bc081bdece (diff)
usb: core: fix potential memory leak in error path during hcd creation
[ Upstream commit 1a744d2eb76aaafb997fda004ae3ae62a1538f85 ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Diffstat (limited to 'drivers/usb/core/hcd.c')
-rw-r--r--drivers/usb/core/hcd.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index a7479ec6e256..029fa26d2ac9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2460,6 +2460,7 @@ struct usb_hcd *usb_create_shared_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;