lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <b507c3b1-931f-4abc-870c-68f377cd7b63@rowland.harvard.edu>
Date: Thu, 14 Nov 2024 18:22:50 -0500
From: Alan Stern <stern@...land.harvard.edu>
To: Vitalii Mordan <mordan@...ras.ru>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	linux-usb@...r.kernel.org, linux-kernel@...r.kernel.org,
	Fedor Pchelkin <pchelkin@...ras.ru>,
	Alexey Khoroshilov <khoroshilov@...ras.ru>,
	Vadim Mutilin <mutilin@...ras.ru>, stable@...r.kernel.org
Subject: Re: [PATCH] usb: ehci-spear: fix call balance of sehci clk handling
 routines

On Fri, Nov 15, 2024 at 02:03:10AM +0300, Vitalii Mordan wrote:
> 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@...r.kernel.org
> Signed-off-by: Vitalii Mordan <mordan@...ras.ru>
> ---

Acked-by: Alan Stern <stern@...land.harvard.edu>

>  drivers/usb/host/ehci-spear.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/usb/host/ehci-spear.c b/drivers/usb/host/ehci-spear.c
> index d0e94e4c9fe2..11294f196ee3 100644
> --- a/drivers/usb/host/ehci-spear.c
> +++ b/drivers/usb/host/ehci-spear.c
> @@ -105,7 +105,9 @@ static int spear_ehci_hcd_drv_probe(struct platform_device *pdev)
>  	/* 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;
> @@ -130,8 +132,7 @@ static void spear_ehci_hcd_drv_remove(struct platform_device *pdev)
>  
>  	usb_remove_hcd(hcd);
>  
> -	if (sehci->clk)
> -		clk_disable_unprepare(sehci->clk);
> +	clk_disable_unprepare(sehci->clk);
>  	usb_put_hcd(hcd);
>  }
>  
> -- 
> 2.25.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ