[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a752f2d7d45d7f57b14cf45a01e583f9d8da0754.camel@gmail.com>
Date: Wed, 27 Apr 2022 06:19:50 +0200
From: Alexander Sverdlin <alexander.sverdlin@...il.com>
To: Wan Jiabing <wanjiabing@...o.com>,
Hartley Sweeten <hsweeten@...ionengravers.com>,
Russell King <linux@...linux.org.uk>,
Nikita Shubin <nikita.shubin@...uefel.me>,
Arnd Bergmann <arnd@...db.de>,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org
Cc: stable@...r.kernel.org
Subject: Re: [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c
Thank you, Wan!
On Wed, 2022-04-27 at 10:21 +0800, Wan Jiabing wrote:
> Fix following coccicheck errors:
> ./arch/arm/mach-ep93xx/clock.c:351:9-12: ERROR: reference preceded by free on line 349
> ./arch/arm/mach-ep93xx/clock.c:458:9-12: ERROR: reference preceded by free on line 456
>
> Fix two more potential UAF errors.
>
> Link: https://lore.kernel.org/all/20220418121212.634259061@linuxfoundation.org/
> Fixes: 9645ccc7bd7a ("ep93xx: clock: convert in-place to COMMON_CLK")
> Signed-off-by: Wan Jiabing <wanjiabing@...o.com>
Acked-by: Alexander Sverdlin <alexander.sverdlin@...il.com>
> ---
> arch/arm/mach-ep93xx/clock.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
> index 4fa6ea5461b7..35f3734e512c 100644
> --- a/arch/arm/mach-ep93xx/clock.c
> +++ b/arch/arm/mach-ep93xx/clock.c
> @@ -345,8 +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 ERR_CAST(clk);
> + }
>
> return &psc->hw;
> }
> @@ -452,8 +454,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 ERR_CAST(clk);
> + }
>
> return &psc->hw;
> }
--
Alexander Sverdlin.
Powered by blists - more mailing lists