linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c
@ 2022-04-27  2:21 Wan Jiabing
  2022-04-27  4:19 ` Alexander Sverdlin
  2022-04-27  4:54 ` Greg KH
  0 siblings, 2 replies; 3+ messages in thread
From: Wan Jiabing @ 2022-04-27  2:21 UTC (permalink / raw)
  To: Hartley Sweeten, Alexander Sverdlin, Russell King, Nikita Shubin,
	Arnd Bergmann, linux-arm-kernel, linux-kernel
  Cc: stable, Wan Jiabing

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@vivo.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;
 }
-- 
2.35.3


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c
  2022-04-27  2:21 [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c Wan Jiabing
@ 2022-04-27  4:19 ` Alexander Sverdlin
  2022-04-27  4:54 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Sverdlin @ 2022-04-27  4:19 UTC (permalink / raw)
  To: Wan Jiabing, Hartley Sweeten, Russell King, Nikita Shubin,
	Arnd Bergmann, linux-arm-kernel, linux-kernel
  Cc: stable

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@vivo.com>

Acked-by: Alexander Sverdlin <alexander.sverdlin@gmail.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.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c
  2022-04-27  2:21 [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c Wan Jiabing
  2022-04-27  4:19 ` Alexander Sverdlin
@ 2022-04-27  4:54 ` Greg KH
  1 sibling, 0 replies; 3+ messages in thread
From: Greg KH @ 2022-04-27  4:54 UTC (permalink / raw)
  To: Wan Jiabing
  Cc: Hartley Sweeten, Alexander Sverdlin, Russell King, Nikita Shubin,
	Arnd Bergmann, linux-arm-kernel, linux-kernel, stable

On Wed, Apr 27, 2022 at 10:21:11AM +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@vivo.com>
> ---
>  arch/arm/mach-ep93xx/clock.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-27  4:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-04-27  2:21 [PATCH] ep93xx: clock: Fix UAF in mach-ep93xx/clock.c Wan Jiabing
2022-04-27  4:19 ` Alexander Sverdlin
2022-04-27  4:54 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).