From ea07cbb08458f91feb97d0e2bcda6a03fe7bf1d3 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 2 Dec 2024 12:18:40 +0100 Subject: [PATCH] 4.19-stable patches added patches: usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch --- queue-4.19/series | 1 + ...lance-of-sehci-clk-handling-routines.patch | 50 +++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 queue-4.19/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch diff --git a/queue-4.19/series b/queue-4.19/series index 24bedfd211a..dbe1023d0df 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -96,3 +96,4 @@ usb-chaoskey-fail-open-after-removal.patch usb-chaoskey-fix-possible-deadlock-chaoskey_list_loc.patch misc-apds990x-fix-missing-pm_runtime_disable.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-4.19/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch b/queue-4.19/usb-ehci-spear-fix-call-balance-of-sehci-clk-handling-routines.patch new file mode 100644 index 00000000000..dc7e52813cb --- /dev/null +++ b/queue-4.19/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