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: <6e0029f6-f499-c688-9174-61409180eae5@gmail.com>
Date:   Sun, 15 May 2022 22:35:47 +0200
From:   Alexander Sverdlin <alexander.sverdlin@...il.com>
To:     Genjian Zhang <zhanggenjian123@...il.com>,
        hsweeten@...ionengravers.com, linux@...linux.org.uk
Cc:     linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Genjian Zhang <zhanggenjian@...inos.cn>
Subject: Re: [PATCH] ep93xx: clock: Do not return the address of the freed
 memory

Hello Genjian!

Thank you for the patch!

On 12/05/2022 09:59, Genjian Zhang wrote:
> Although there will be basic judgments of IS_ERR() on this return value
> elsewhere,but I think it can be replaced by the actual error return
> value of clk_register.

Actually this fixes very similar use-after-free which I missed in
commit 9645ccc7bd7a1.

I propose to add
Fixes: 9645ccc7bd7a1 ("ep93xx: clock: convert in-place to COMMON_CLK")

> Signed-off-by: Genjian Zhang <zhanggenjian@...inos.cn>
> ---
>  arch/arm/mach-ep93xx/clock.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
> index 4fa6ea5461b7..762328de4bce 100644
> --- a/arch/arm/mach-ep93xx/clock.c
> +++ b/arch/arm/mach-ep93xx/clock.c
> @@ -345,9 +345,10 @@ static struct clk_hw *clk_hw_register_ddiv(const char *name,
>  	psc->hw.init = &init;
>  
>  	clk = clk_register(NULL, &psc->hw);
> -	if (IS_ERR(clk))
> +	if (IS_ERR(clk)) {
>  		kfree(psc);
> -
> +		return (struct clk_hw *)clk;

Could you please use ERR_CAST()?

> +	}
>  	return &psc->hw;
>  }
>  
> @@ -452,9 +453,10 @@ static struct clk_hw *clk_hw_register_div(const char *name,
>  	psc->hw.init = &init;
>  
>  	clk = clk_register(NULL, &psc->hw);
> -	if (IS_ERR(clk))
> +	if (IS_ERR(clk)) {
>  		kfree(psc);
> -
> +		return (struct clk_hw *)clk;

same as above

> +	}
>  	return &psc->hw;
>  }
>  

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ