Skip to content

Commit e90fbbc

Browse files
Zhang Qilongksacilotto
authored andcommitted
usb: oxu210hp-hcd: Fix memory leak in oxu_create
BugLink: https://bugs.launchpad.net/bugs/1910822 [ Upstream commit e5548b0 ] usb_create_hcd will alloc memory for hcd, and we should call usb_put_hcd to free it when adding fails to prevent memory leak. Fixes: b92a78e ("usb host: Oxford OXU210HP HCD driver") Reported-by: Hulk Robot <hulkci@huawei.com> Signed-off-by: Zhang Qilong <zhangqilong3@huawei.com> Link: https://lore.kernel.org/r/20201123145809.1456541-1-zhangqilong3@huawei.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Kamal Mostafa <kamal@canonical.com> Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
1 parent f998e67 commit e90fbbc

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/usb/host/oxu210hp-hcd.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4149,8 +4149,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev,
41494149
oxu->is_otg = otg;
41504150

41514151
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
4152-
if (ret < 0)
4152+
if (ret < 0) {
4153+
usb_put_hcd(hcd);
41534154
return ERR_PTR(ret);
4155+
}
41544156

41554157
device_wakeup_enable(hcd->self.controller);
41564158
return hcd;

0 commit comments

Comments
 (0)