Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: dwc3: of-simple: fix clock resource leak in dwc3_of_simple_probe

When clk_bulk_prepare_enable() fails, the error path jumps to
err_resetc_assert, skipping clk_bulk_put_all() and leaking the
clock references acquired by clk_bulk_get_all().

Add err_clk_put_all label to properly release clock resources
in all error paths.

Found via static analysis and code review.

Fixes: c0c61471ef86 ("usb: dwc3: of-simple: Convert to bulk clk API")
Cc: stable <stable@kernel.org>
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Acked-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://patch.msgid.link/20251211064937.2360510-1-linmq006@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Miaoqian Lin and committed by
Greg Kroah-Hartman
3b496131 14ad4c10

+4 -3
+4 -3
drivers/usb/dwc3/dwc3-of-simple.c
··· 70 70 simple->num_clocks = ret; 71 71 ret = clk_bulk_prepare_enable(simple->num_clocks, simple->clks); 72 72 if (ret) 73 - goto err_resetc_assert; 73 + goto err_clk_put_all; 74 74 75 75 ret = of_platform_populate(np, NULL, NULL, dev); 76 76 if (ret) 77 - goto err_clk_put; 77 + goto err_clk_disable; 78 78 79 79 pm_runtime_set_active(dev); 80 80 pm_runtime_enable(dev); ··· 82 82 83 83 return 0; 84 84 85 - err_clk_put: 85 + err_clk_disable: 86 86 clk_bulk_disable_unprepare(simple->num_clocks, simple->clks); 87 + err_clk_put_all: 87 88 clk_bulk_put_all(simple->num_clocks, simple->clks); 88 89 89 90 err_resetc_assert: