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: <a2frlti34dyfiiky3mtcmfz44qtntckrv3i2uzz5pr3aemw2qy@zihefw3poqrf>
Date: Mon, 13 Jan 2025 14:47:35 +0100
From: Joel Granados <joel.granados@...nel.org>
To: Charles Han <hanchunchao@...pur.com>
Cc: kees@...nel.org, logang@...tatee.com, mcgrof@...nel.org, 
	yzaikin@...gle.com, gregkh@...uxfoundation.org, brendan.higgins@...ux.dev, 
	linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org
Subject: Re: [PATCH] kernel/sysctl-test: Fix potential null dereference in
 sysctl-test

On Fri, Jan 10, 2025 at 06:07:48PM +0800, Charles Han wrote:
> kunit_kzalloc() may return a NULL pointer, dereferencing it without
> NULL check may lead to NULL dereference.
> Add a NULL check for buffer.

Please address the 0-day comments.
> 
> Fixes: 2cb80dbbbaba ("kernel/sysctl-test: Add null pointer test for sysctl.c:proc_dointvec()")
> Signed-off-by: Charles Han <hanchunchao@...pur.com>
> ---
...
>  	unsigned long abs_of_less_than_min = (unsigned long)INT_MAX
>  					     - (INT_MAX + INT_MIN) + 1;
> @@ -354,6 +363,7 @@ static void sysctl_test_api_dointvec_write_single_greater_int_max(
>  	size_t max_len = 32, len = max_len;
>  	loff_t pos = 0;
>  	char *buffer = kunit_kzalloc(test, max_len, GFP_USER);
> +	KUNIT_ASSERT_NOT_ERR_OR_NULL(test, buffer);
>  	char __user *user_buffer = (char __user *)buffer;
>  	unsigned long greater_than_max = (unsigned long)INT_MAX + 1;
>  
> -- 
> 2.45.2
> 

best
-- 

Joel Granados

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ