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  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]
Date:   Sun, 10 Sep 2017 23:40:48 +0800
From:   Sean Fu <fxinrong@...il.com>
To:     tglx@...utronix.de
Cc:     mingo@...hat.com, hpa@...or.com, x86@...nel.org,
        fxinrong@...il.com, linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] x86: Fix off-by-one error in loop termination.

An off-by-one error in loop terminantion conditions in
create_setup_data_nodes will lead to memory leak when
create_setup_data_node return error.

Signed-off-by: Sean Fu <fxinrong@...il.com>
---
 arch/x86/kernel/ksysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/ksysfs.c b/arch/x86/kernel/ksysfs.c
index 4afc67f..cfde6c0 100644
--- a/arch/x86/kernel/ksysfs.c
+++ b/arch/x86/kernel/ksysfs.c
@@ -299,7 +299,7 @@ static int __init create_setup_data_nodes(struct kobject *parent)
 	return 0;
 
 out_clean_nodes:
-	for (j = i - 1; j > 0; j--)
+	for (j = i - 1; j >= 0; j--)
 		cleanup_setup_data_node(*(kobjp + j));
 	kfree(kobjp);
 out_setup_data_kobj:
-- 
2.6.2

Powered by blists - more mailing lists