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]
Date:   Tue,  9 Mar 2021 01:02:15 -0800
From:   Jia-Ju Bai <baijiaju1990@...il.com>
To:     bigeasy@...utronix.de
Cc:     linux-kernel@...r.kernel.org, Jia-Ju Bai <baijiaju1990@...il.com>
Subject: [PATCH] kernel: profile: fix error return code of create_proc_profile()

When proc_create() returns NULL to entry, no error return code of
create_proc_profile() is assigned.
To fix this bug, err is assigned with -ENOMEM in this case.

Fixes: e722d8daafb9 ("profile: Convert to hotplug state machine")
Reported-by: TOTE Robot <oslab@...nghua.edu.cn>
Signed-off-by: Jia-Ju Bai <baijiaju1990@...il.com>
---
 kernel/profile.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/profile.c b/kernel/profile.c
index 6f69a4195d56..65bf03bb8a5e 100644
--- a/kernel/profile.c
+++ b/kernel/profile.c
@@ -549,8 +549,10 @@ int __ref create_proc_profile(void)
 #endif
 	entry = proc_create("profile", S_IWUSR | S_IRUGO,
 			    NULL, &profile_proc_ops);
-	if (!entry)
+	if (!entry) {
+		err = -ENOMEM;
 		goto err_state_onl;
+	}
 	proc_set_size(entry, (1 + prof_len) * sizeof(atomic_t));
 
 	return err;
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ