[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230418065308.452462-1-d.dulov@aladdin.ru>
Date: Mon, 17 Apr 2023 23:53:08 -0700
From: Daniil Dulov <d.dulov@...ddin.ru>
To: Thomas Gleixner <tglx@...utronix.de>
CC: Daniil Dulov <d.dulov@...ddin.ru>, Ingo Molnar <mingo@...hat.com>,
Borislav Petkov <bp@...en8.de>, <x86@...nel.org>,
"H. Peter Anvin" <hpa@...or.com>, Baoquan He <bhe@...hat.com>,
Kees Cook <keescook@...omium.org>,
<linux-kernel@...r.kernel.org>, <lvc-project@...uxtesting.org>
Subject: [PATCH] x86/kaslr: Fix potential dereference of NULL pointer.
Pointer val can have NULL value. Then its value is assigned to the pointer p.
p is dereferenced by calling strcmp().
Found by Linux Verification Center (linuxtesting.org) with SVACE.
Fixes: 4cdba14f84c9 ("x86/KASLR: Handle the memory limit specified by the 'memmap=' and 'mem=' boot options")
Signed-off-by: Daniil Dulov <d.dulov@...ddin.ru>
---
arch/x86/boot/compressed/kaslr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index b92fffbe761f..51b3925d4d2d 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -291,7 +291,7 @@ static void handle_mem_options(void)
} else if (!strcmp(param, "mem")) {
char *p = val;
- if (!strcmp(p, "nopentium"))
+ if (!p || !strcmp(p, "nopentium"))
continue;
mem_size = memparse(p, &p);
if (mem_size == 0)
--
2.25.1
Powered by blists - more mailing lists