Skip to content

Commit e5548b0

Browse files
Zhang Qilonggregkh
authored andcommitted
usb: oxu210hp-hcd: Fix memory leak in oxu_create
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>
1 parent 3b78ef0 commit e5548b0

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
@@ -4152,8 +4152,10 @@ static struct usb_hcd *oxu_create(struct platform_device *pdev,
41524152
oxu->is_otg = otg;
41534153

41544154
ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
4155-
if (ret < 0)
4155+
if (ret < 0) {
4156+
usb_put_hcd(hcd);
41564157
return ERR_PTR(ret);
4158+
}
41574159

41584160
device_wakeup_enable(hcd->self.controller);
41594161
return hcd;

0 commit comments

Comments
 (0)