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: <CAMpQs4K5Xw4_M1TXTkc_zGaeuD2K_R6pO1PKyhOOJG_XvQuF9A@mail.gmail.com>
Date: Thu, 20 Feb 2025 14:52:21 +0800
From: Binbin Zhou <zhoubb.aaron@...il.com>
To: Haoxiang Li <haoxiang_li2024@....com>
Cc: zhuyinbo@...ngson.cn, arnd@...db.de, loongarch@...ts.linux.dev, 
	linux-kernel@...r.kernel.org, stable@...r.kernel.org, 
	Binbin Zhou <zhoubinbin@...ngson.cn>
Subject: Re: [PATCH] drivers: loongson: Add check for devm_kstrdup()

Hi Haoxiang:

Please rewrite the patch title as "soc: loongson: loongson2_guts: Add
check for devm_kstrdup()",  and cc soc@...nel.org, because that is the
most appropriate list for this patch.

On Wed, Feb 19, 2025 at 11:23 AM Haoxiang Li <haoxiang_li2024@....com> wrote:
>
> Add check for the return value of devm_kstrdup() in
> loongson2_guts_probe() to catch potential exception.
>
> Fixes: b82621ac8450 ("soc: loongson: add GUTS driver for loongson-2 platforms")
> Cc: stable@...r.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@....com>
> ---
>  drivers/soc/loongson/loongson2_guts.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/soc/loongson/loongson2_guts.c b/drivers/soc/loongson/loongson2_guts.c
> index ae42e3a9127f..26212cfcf6b0 100644
> --- a/drivers/soc/loongson/loongson2_guts.c
> +++ b/drivers/soc/loongson/loongson2_guts.c
> @@ -117,6 +117,8 @@ static int loongson2_guts_probe(struct platform_device *pdev)
>         if (machine)
>                 soc_dev_attr.machine = devm_kstrdup(dev, machine, GFP_KERNEL);
>
> +       if (!soc_dev_attr.machine)
> +               return -ENOMEM;

I think this exception check should follow directly after devm_kstrdup().
Otherwise the whole driver exits here when the “machine" is empty,
which is not what we expect.

You can refer to:
https://elixir.bootlin.com/linux/v6.14-rc3/source/drivers/soc/fsl/guts.c#L224

>         svr = loongson2_guts_get_svr();
>         soc_die = loongson2_soc_die_match(svr, loongson2_soc_die);
>         if (soc_die) {
> --
> 2.25.1
>
>
--
Thanks.
Binbin

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ