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: <20250425003836.74f068da@minigeek.lan>
Date: Fri, 25 Apr 2025 00:38:36 +0100
From: Andre Przywara <andre.przywara@....com>
To: Chenyuan Yang <chenyuan0y@...il.com>
Cc: wens@...e.org, jernej.skrabec@...il.com, samuel@...lland.org,
 arnd@...db.de, hdegoede@...hat.com, mripard@...nel.org,
 linux-arm-kernel@...ts.infradead.org, linux-sunxi@...ts.linux.dev,
 linux-kernel@...r.kernel.org
Subject: Re: [PATCH] drivers: soc: sunxi: Fix possible null pointer
 dereference

On Sat, 12 Apr 2025 11:57:00 -0500
Chenyuan Yang <chenyuan0y@...il.com> wrote:

> of_get_address() may return NULL which is later dereferenced.
> Fix this bug by adding NULL check
> 
> This is similar to the commit c534b63bede6
> ("drm: vc4: Fix possible null pointer dereference").
> 
> Signed-off-by: Chenyuan Yang <chenyuan0y@...il.com>
> Fixes: 4af34b572a85 ("drivers: soc: sunxi: Introduce SoC driver to map SRAMs")

That fix looks alright, indeed of_get_address() returns NULL if the
slightest bit in the property is not as expected, and we should check
for that.

I am just wondering if we should issue a firmware warning in this case,
instead of just silently skipping an entry.

Cheers,
Andre

> ---
>  drivers/soc/sunxi/sunxi_sram.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/soc/sunxi/sunxi_sram.c b/drivers/soc/sunxi/sunxi_sram.c
> index 2781a091a6a6..1853dcc806ea 100644
> --- a/drivers/soc/sunxi/sunxi_sram.c
> +++ b/drivers/soc/sunxi/sunxi_sram.c
> @@ -122,6 +122,8 @@ static int sunxi_sram_show(struct seq_file *s, void *data)
>  			continue;
>  
>  		sram_addr_p = of_get_address(sram_node, 0, NULL, NULL);
> +		if (!sram_addr_p)
> +			continue;
>  
>  		seq_printf(s, "sram@...x\n",
>  			   be32_to_cpu(*sram_addr_p));
> @@ -134,6 +136,8 @@ static int sunxi_sram_show(struct seq_file *s, void *data)
>  
>  			section_addr_p = of_get_address(section_node, 0,
>  							NULL, NULL);
> +			if (!section_addr_p)
> +				continue;
>  
>  			seq_printf(s, "\tsection@...x\t(%s)\n",
>  				   be32_to_cpu(*section_addr_p),


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ