]> git.baikalelectronics.ru Git - kernel.git/commit
usb: dwc2: Fix memory leak in dwc2_hcd_init
authorMiaoqian Lin <linmq006@gmail.com>
Mon, 30 May 2022 08:54:12 +0000 (12:54 +0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jun 2022 09:12:20 +0000 (11:12 +0200)
commitc097988bbd30183c895970233c840eef564add35
treea64e8febf71e522b82ae3477e872bc59784953e2
parent65be083eea1e420374f1d3cd9357c6fb0782b3bc
usb: dwc2: Fix memory leak in dwc2_hcd_init

usb_create_hcd will alloc memory for hcd, and we should
call usb_put_hcd to free it when platform_get_resource()
fails to prevent memory leak.
goto error2 label instead error1 to fix this.

Fixes: 1a68fdb1dd16 ("usb: dwc2: check return value after calling platform_get_resource()")
Cc: stable <stable@kernel.org>
Acked-by: Minas Harutyunyan <hminas@synopsys.com>
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Link: https://lore.kernel.org/r/20220530085413.44068-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc2/hcd.c