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: <20211022012832.10644-1-yang.guang5@zte.com.cn>
Date:   Fri, 22 Oct 2021 09:28:32 +0800
From:   davidcomponentone@...il.com
To:     keescook@...omium.org
Cc:     arnd@...db.de, gregkh@...uxfoundation.org,
        linux-kernel@...r.kernel.org, Yang Guang <yang.guang5@....com.cn>,
        Zeal Robot <zealci@....com.cn>
Subject: [PATCH lkdtm] lkdtm: Fix reference preceded by free

From: Yang Guang <yang.guang5@....com.cn>

The coccinelle check report:
./drivers/misc/lkdtm/heap.c:115:7-11:
ERROR: reference preceded by free on line 112
Moving the "kfree(base)" after using place to fix it.

Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Yang Guang <yang.guang5@....com.cn>
---
 drivers/misc/lkdtm/heap.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/misc/lkdtm/heap.c b/drivers/misc/lkdtm/heap.c
index 8a92f5a800fa..4c6341e7bdca 100644
--- a/drivers/misc/lkdtm/heap.c
+++ b/drivers/misc/lkdtm/heap.c
@@ -109,8 +109,6 @@ void lkdtm_READ_AFTER_FREE(void)
 	base[offset] = *val;
 	pr_info("Value in memory before free: %x\n", base[offset]);
 
-	kfree(base);
-
 	pr_info("Attempting bad read from freed memory\n");
 	saw = base[offset];
 	if (saw != *val) {
@@ -121,6 +119,7 @@ void lkdtm_READ_AFTER_FREE(void)
 		pr_expected_config_param(CONFIG_INIT_ON_FREE_DEFAULT_ON, "init_on_free");
 	}
 
+	kfree(base);
 	kfree(val);
 }
 
-- 
2.30.2

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ