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: <20220725081331.21014-1-renyu@nfschina.com>
Date:   Mon, 25 Jul 2022 16:13:31 +0800
From:   Ren Yu <renyu@...china.com>
To:     keescook@...omium.org, arnd@...db.de, gregkh@...uxfoundation.org,
        linux-kernel@...r.kernel.org
Cc:     liqiong@...china.com, yuzhe@...china.com,
        Ren Yu <renyu@...china.com>
Subject: [PATCH 3/3] lkdtm/heap: Check possible NULL pointer returned by vzalloc()

As the possible alloc failure of the vzalloc(),the
return pointer could be NULL.therefore it should be better to check it.

Signed-off-by: Ren Yu <renyu@...china.com>
---
 drivers/misc/lkdtm/heap.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/misc/lkdtm/heap.c b/drivers/misc/lkdtm/heap.c
index 62516078a619..399cdbbfd5b7 100644
--- a/drivers/misc/lkdtm/heap.c
+++ b/drivers/misc/lkdtm/heap.c
@@ -33,9 +33,13 @@ static void lkdtm_VMALLOC_LINEAR_OVERFLOW(void)
 	one = vzalloc(PAGE_SIZE);
 	two = vzalloc(PAGE_SIZE);
 
+	if (!one || !two)
+		goto free_kernel;
+
 	pr_info("Attempting vmalloc linear overflow ...\n");
 	memset(one, 0xAA, PAGE_SIZE + __offset);
 
+free_kernel:
 	vfree(two);
 	vfree(one);
 }
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ