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: <175054103949.4372.16293868938290251169@lazor>
Date: Sat, 21 Jun 2025 14:23:59 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: Henry Martin <bsdhenrymartin@...il.com>, andrew@...n.ch, gregory.clement@...tlin.com, mturquette@...libre.com, sebastian.hesselbarth@...il.com
Cc: linux-arm-kernel@...ts.infradead.org, linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org, Henry Martin <bsdhenrymartin@...il.com>
Subject: Re: [PATCH v1] ASoC: imx-card: Add NULL check in ap806_syscon_common_probe()

Quoting Henry Martin (2025-04-09 20:04:38)
> devm_kasprintf() in ap_cp_unique_name() returns NULL when memory
> allocation fails. Currently, ap806_syscon_common_probe() does not check
> for this case, which results in a NULL pointer dereference.
> 
> Add NULL check after ap_cp_unique_name() to prevent this issue.
> 
> Fixes: baf4c10f8878 ("clk: mvebu: ap806: Fix clock name for the cluster")
> Fixes: 33c0259092c8 ("clk: mvebu: add helper file for Armada AP and CP clocks")
> Signed-off-by: Henry Martin <bsdhenrymartin@...il.com>
> ---
>  drivers/clk/mvebu/ap806-system-controller.c | 24 +++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/clk/mvebu/ap806-system-controller.c b/drivers/clk/mvebu/ap806-system-controller.c
> index 948bd1e71aea..1461922752e3 100644
> --- a/drivers/clk/mvebu/ap806-system-controller.c
> +++ b/drivers/clk/mvebu/ap806-system-controller.c
> @@ -173,6 +173,10 @@ static int ap806_syscon_common_probe(struct platform_device *pdev,
>  
>         /* CPU clocks depend on the Sample At Reset configuration */
>         name = ap_cp_unique_name(dev, syscon_node, "pll-cluster-0");
> +       if (!name) {
> +               ret = -ENOMEM;
> +               goto fail0;
> +       }
>         ap806_clks[0] = clk_register_fixed_rate(dev, name, NULL,

TL;DR: This patch is unnecessary.

If name is NULL this function will fail. See the kstrdup_const() call in
__clk_register() and how it returns -ENOMEM when the copy of the
init.name is NULL, which is what happens when you duplicate a NULL
pointer.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ