This is a note to let you know that I've just added the patch titled usb: dwc3: qcom: Fix memory leak in dwc3_qcom_interconnect_init to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: usb-dwc3-qcom-fix-memory-leak-in-dwc3_qcom_interconnect_init.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 97a48da1619ba6bd42a0e5da0a03aa490a9496b1 Mon Sep 17 00:00:00 2001 From: Miaoqian Lin <linmq006@xxxxxxxxx> Date: Tue, 6 Dec 2022 12:17:31 +0400 Subject: usb: dwc3: qcom: Fix memory leak in dwc3_qcom_interconnect_init From: Miaoqian Lin <linmq006@xxxxxxxxx> commit 97a48da1619ba6bd42a0e5da0a03aa490a9496b1 upstream. of_icc_get() alloc resources for path handle, we should release it when not need anymore. Like the release in dwc3_qcom_interconnect_exit() function. Add icc_put() in error handling to fix this. Fixes: bea46b981515 ("usb: dwc3: qcom: Add interconnect support in dwc3 driver") Cc: stable <stable@xxxxxxxxxx> Acked-by: Thinh Nguyen <Thinh.Nguyen@xxxxxxxxxxxx> Signed-off-by: Miaoqian Lin <linmq006@xxxxxxxxx> Link: https://lore.kernel.org/r/20221206081731.818107-1-linmq006@xxxxxxxxx Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/usb/dwc3/dwc3-qcom.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) --- a/drivers/usb/dwc3/dwc3-qcom.c +++ b/drivers/usb/dwc3/dwc3-qcom.c @@ -261,7 +261,8 @@ static int dwc3_qcom_interconnect_init(s if (IS_ERR(qcom->icc_path_apps)) { dev_err(dev, "failed to get apps-usb path: %ld\n", PTR_ERR(qcom->icc_path_apps)); - return PTR_ERR(qcom->icc_path_apps); + ret = PTR_ERR(qcom->icc_path_apps); + goto put_path_ddr; } max_speed = usb_get_maximum_speed(&qcom->dwc3->dev); @@ -274,16 +275,22 @@ static int dwc3_qcom_interconnect_init(s } if (ret) { dev_err(dev, "failed to set bandwidth for usb-ddr path: %d\n", ret); - return ret; + goto put_path_apps; } ret = icc_set_bw(qcom->icc_path_apps, APPS_USB_AVG_BW, APPS_USB_PEAK_BW); if (ret) { dev_err(dev, "failed to set bandwidth for apps-usb path: %d\n", ret); - return ret; + goto put_path_apps; } return 0; + +put_path_apps: + icc_put(qcom->icc_path_apps); +put_path_ddr: + icc_put(qcom->icc_path_ddr); + return ret; } /** Patches currently in stable-queue which might be from linmq006@xxxxxxxxx are queue-6.1/selftests-powerpc-fix-resource-leaks.patch queue-6.1/cxl-fix-refcount-leak-in-cxl_calc_capp_routing.patch queue-6.1/usb-dwc3-qcom-fix-memory-leak-in-dwc3_qcom_interconnect_init.patch queue-6.1/module-fix-null-vs-is_err-checking-for-module_get_ne.patch queue-6.1/bpftool-fix-memory-leak-in-do_build_table_cb.patch