The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH 5.10/5.15] clk: imx: Add check for kcalloc
@ 2026-07-03 12:13 Alexandra Diupina
  2026-07-04  2:05 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandra Diupina @ 2026-07-03 12:13 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Alexandra Diupina, Abel Vesa, Michael Turquette, Stephen Boyd,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Adam Ford, linux-clk, linux-arm-kernel,
	linux-kernel, Jiasheng Jiang, Abel Vesa, Peng Fan, Brian Masney,
	Frank Li, imx, lvc-project

From: Jiasheng Jiang <jiasheng@iscas.ac.cn>

commit ed713e2bc093239ccd380c2ce8ae9e4162f5c037 upstream.

As the potential failure of the kcalloc(),
it should be better to check it in order to
avoid the dereference of the NULL pointer.

Fixes: 379c9a24cc23 ("clk: imx: Fix reparenting of UARTs not associated with stdout")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Reviewed-by: Abel Vesa <abel.vesa@nxp.com>
Link: https://lore.kernel.org/r/20220310080257.1988412-1-jiasheng@iscas.ac.cn
Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
---
Backport fix for CVE-2022-3114
 drivers/clk/imx/clk.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/imx/clk.c b/drivers/clk/imx/clk.c
index d4cf0c7045ab2..be0493e5b494e 100644
--- a/drivers/clk/imx/clk.c
+++ b/drivers/clk/imx/clk.c
@@ -173,6 +173,8 @@ void imx_register_uart_clocks(unsigned int clk_count)
 		int i;
 
 		imx_uart_clocks = kcalloc(clk_count, sizeof(struct clk *), GFP_KERNEL);
+		if (!imx_uart_clocks)
+			return;
 
 		if (!of_stdout)
 			return;
-- 
2.47.3

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

* Re: [PATCH 5.10/5.15] clk: imx: Add check for kcalloc
  2026-07-03 12:13 [PATCH 5.10/5.15] clk: imx: Add check for kcalloc Alexandra Diupina
@ 2026-07-04  2:05 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-07-04  2:05 UTC (permalink / raw)
  To: stable, Greg Kroah-Hartman
  Cc: Sasha Levin, Alexandra Diupina, Abel Vesa, Michael Turquette,
	Stephen Boyd, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, NXP Linux Team, Adam Ford, linux-clk,
	linux-arm-kernel, linux-kernel, Jiasheng Jiang, Abel Vesa,
	Peng Fan, Brian Masney, Frank Li, imx, lvc-project

On Thu, Jul 03, 2026 at 03:13:38PM +0300, Alexandra Diupina wrote:
> From: Jiasheng Jiang <jiasheng@iscas.ac.cn>
>
> commit ed713e2bc093239ccd380c2ce8ae9e4162f5c037 upstream.
>
> As the potential failure of the kcalloc(),
> it should be better to check it in order to
> avoid the dereference of the NULL pointer.

Queued for 5.15.y and 5.10.y, thanks!

-- 
Thanks,
Sasha

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

end of thread, other threads:[~2026-07-04  2:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-03 12:13 [PATCH 5.10/5.15] clk: imx: Add check for kcalloc Alexandra Diupina
2026-07-04  2:05 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox