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-next>] [day] [month] [year] [list]
Message-Id: <20221206125929.12237-1-zhiguangni01@gmail.com>
Date:   Tue,  6 Dec 2022 20:59:29 +0800
From:   Liam Ni <zhiguangni01@...il.com>
To:     x86@...nel.org, linux-kernel@...r.kernel.org,
        linux-arch@...r.kernel.org, linux-efi@...r.kernel.org,
        linux-doc@...r.kernel.org, linux-mm@...ck.org, kvm@...r.kernel.org,
        kasan-dev@...glegroups.com
Cc:     zhiguangni01@...il.com
Subject: [PATCH] x86/boot: Check if the input parameter (buffer) of the function is a null pointer

If the variable buffer is a null pointer, it may cause the kernel to crash.

Signed-off-by: Liam Ni <zhiguangni01@...il.com>
---
 arch/x86/boot/cmdline.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/boot/cmdline.c b/arch/x86/boot/cmdline.c
index 21d56ae83cdf..d0809f66054c 100644
--- a/arch/x86/boot/cmdline.c
+++ b/arch/x86/boot/cmdline.c
@@ -39,7 +39,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b
 		st_bufcpy	/* Copying this to buffer */
 	} state = st_wordstart;
 
-	if (!cmdline_ptr)
+	if (!cmdline_ptr || buffer == NULL)
 		return -1;      /* No command line */
 
 	cptr = cmdline_ptr & 0xf;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ