From 8ddac27a9e5c390b7ea444ce44111157ae5198f4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 2 Dec 2024 12:19:01 +0100 Subject: [PATCH] 5.4-stable patches added patches: usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch --- queue-5.4/series | 1 + ...lance-of-sehci-clk-handling-routines.patch | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 queue-5.4/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch diff --git a/queue-5.4/series b/queue-5.4/series index 8a8899e557a..5e7266966e8 100644 --- a/queue-5.4/series +++ b/queue-5.4/series @@ -141,3 +141,4 @@ misc-apds990x-fix-missing-pm_runtime_disable.patch staging-greybus-uart-clean-up-tiocgserial.patch staging-greybus-uart-fix-atomicity-violation-in-get_.patch apparmor-fix-do-simple-duplicate-message-elimination.patch +usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch diff --git a/queue-5.4/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch b/queue-5.4/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch new file mode 100644 index 00000000000..dc7e52813cb --- /dev/null +++ b/queue-5.4/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch @@ -0,0 +1,50 @@ +From 40c974826734836402abfd44efbf04f63a2cc1c1 Mon Sep 17 00:00:00 2001 +From: Vitalii Mordan +Date: Fri, 15 Nov 2024 02:03:10 +0300 +Subject: usb: ehci-spear: fix call balance of sehci clk handling routines + +From: Vitalii Mordan + +commit 40c974826734836402abfd44efbf04f63a2cc1c1 upstream. + +If the clock sehci->clk was not enabled in spear_ehci_hcd_drv_probe, +it should not be disabled in any path. + +Conversely, if it was enabled in spear_ehci_hcd_drv_probe, it must be disabled +in all error paths to ensure proper cleanup. + +Found by Linux Verification Center (linuxtesting.org) with Klever. + +Fixes: 7675d6ba436f ("USB: EHCI: make ehci-spear a separate driver") +Cc: stable@vger.kernel.org +Signed-off-by: Vitalii Mordan +Acked-by: Alan Stern +Link: https://lore.kernel.org/r/20241114230310.432213-1-mordan@ispras.ru +Signed-off-by: Greg Kroah-Hartman +--- + drivers/usb/host/ehci-spear.c | 7 ++++--- + 1 file changed, 4 insertions(+), 3 deletions(-) + +--- a/drivers/usb/host/ehci-spear.c ++++ b/drivers/usb/host/ehci-spear.c +@@ -110,7 +110,9 @@ static int spear_ehci_hcd_drv_probe(stru + /* registers start at offset 0x0 */ + hcd_to_ehci(hcd)->caps = hcd->regs; + +- clk_prepare_enable(sehci->clk); ++ retval = clk_prepare_enable(sehci->clk); ++ if (retval) ++ goto err_put_hcd; + retval = usb_add_hcd(hcd, irq, IRQF_SHARED); + if (retval) + goto err_stop_ehci; +@@ -135,8 +137,7 @@ static int spear_ehci_hcd_drv_remove(str + + usb_remove_hcd(hcd); + +- if (sehci->clk) +- clk_disable_unprepare(sehci->clk); ++ clk_disable_unprepare(sehci->clk); + usb_put_hcd(hcd); + + return 0; -- 2.47.3