usb: dwc2: Fix memory leak in dwc2_hcd_init
stable inclusion from stable-v4.19.315 commit 84e6d0af87e27bbc0db94f2e7323b34abe17b6e5 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9R4OY CVE: CVE-2021-47409 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.19.315&id=84e6d0af87e27bbc0db94f2e7323b34abe17b6e5 -------------------------------- commit 3755278f upstream. 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: 856e6e8e ("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> Signed-off-by:
Wenyu Huang <huangwenyu5@huawei.com>
Loading
Please sign in to comment