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: <aTrJMi7q_DX4K8_c@luna>
Date: Thu, 11 Dec 2025 14:37:54 +0100
From: Link Mauve <linkmauve@...kmauve.fr>
To: Haotian Zhang <vulab@...as.ac.cn>
Cc: srini@...nel.org, linkmauve@...kmauve.fr, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nvmem: nintendo-otp: Fix potential NULL pointer
 dereference in nintendo_otp_probe()

Hi,

On Wed, Dec 10, 2025 at 11:38:03AM +0800, Haotian Zhang wrote:
> of_match_device() may return NULL if no match is found.
> Dereferencing the return value of_id in nintendo_otp_probe()
> without a check could lead to a NULL pointer dereference.
> 
> Add a check for of_id and return -ENODEV upon failure.
> 
> Fixes: 3683b761fe3a ("nvmem: nintendo-otp: Add new driver for the Wii and Wii U OTP")
> Signed-off-by: Haotian Zhang <vulab@...as.ac.cn>
> ---
>  drivers/nvmem/nintendo-otp.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/nvmem/nintendo-otp.c b/drivers/nvmem/nintendo-otp.c
> index 355e7f1fc6d5..89b15a58bf88 100644
> --- a/drivers/nvmem/nintendo-otp.c
> +++ b/drivers/nvmem/nintendo-otp.c
> @@ -87,6 +87,9 @@ static int nintendo_otp_probe(struct platform_device *pdev)
>  		.root_only = true,
>  	};
>  
> +	if (!of_id)
> +		return -ENODEV;
> +
>  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
>  	if (!priv)
>  		return -ENOMEM;
> -- 
> 2.50.1.windows.1
> 

Thank you for that, this patch is:
Reviewed-by: Link Mauve <kernel@...kmauve.fr>

-- 
Link Mauve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ