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>] [day] [month] [year] [list]
Message-Id: <20211216015932.258088-1-jiasheng@iscas.ac.cn>
Date:   Thu, 16 Dec 2021 09:59:32 +0800
From:   Jiasheng Jiang <jiasheng@...as.ac.cn>
To:     keescook@...omium.org, arnd@...db.de, gregkh@...uxfoundation.org
Cc:     linux-kernel@...r.kernel.org, Jiasheng Jiang <jiasheng@...as.ac.cn>
Subject: [PATCH] lkdtm: potential dereference of null pointer

The return value of kmalloc() needs to be checked.
To avoid use in execute_location() in case of the failure of alloc.

Fixes: 039a1c42058d ("lkdtm: Relocate code to subdirectory")
Signed-off-by: Jiasheng Jiang <jiasheng@...as.ac.cn>
---
 drivers/misc/lkdtm/perms.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/misc/lkdtm/perms.c b/drivers/misc/lkdtm/perms.c
index 2dede2ef658f..ef87d9cc2e96 100644
--- a/drivers/misc/lkdtm/perms.c
+++ b/drivers/misc/lkdtm/perms.c
@@ -138,6 +138,8 @@ void lkdtm_EXEC_STACK(void)
 void lkdtm_EXEC_KMALLOC(void)
 {
 	u32 *kmalloc_area = kmalloc(EXEC_SIZE, GFP_KERNEL);
+	if (!kmalloc_area)
+		return;
 	execute_location(kmalloc_area, CODE_WRITE);
 	kfree(kmalloc_area);
 }
@@ -145,6 +147,8 @@ void lkdtm_EXEC_KMALLOC(void)
 void lkdtm_EXEC_VMALLOC(void)
 {
 	u32 *vmalloc_area = vmalloc(EXEC_SIZE);
+	if (!vmalloc_area)
+		return;
 	execute_location(vmalloc_area, CODE_WRITE);
 	vfree(vmalloc_area);
 }
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ