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-prev] [day] [month] [year] [list]
Message-ID: <176408978875.498.9214136366771831705.tip-bot2@tip-bot2>
Date: Tue, 25 Nov 2025 16:56:28 -0000
From: "tip-bot2 for Dan Carpenter" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Dan Carpenter <dan.carpenter@...aro.org>,
 Thomas Gleixner <tglx@...utronix.de>, Malaya Kumar Rout <mrout@...hat.com>,
 x86@...nel.org, linux-kernel@...r.kernel.org
Subject:
 [tip: timers/urgent] timekeeping: Fix error code in tk_aux_sysfs_init()

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     c7418164b463056bf4327b6a2abe638b78250f13
Gitweb:        https://git.kernel.org/tip/c7418164b463056bf4327b6a2abe638b78250f13
Author:        Dan Carpenter <dan.carpenter@...aro.org>
AuthorDate:    Tue, 25 Nov 2025 16:55:19 +03:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 25 Nov 2025 17:52:24 +01:00

timekeeping: Fix error code in tk_aux_sysfs_init()

If kobject_create_and_add() fails on the first iteration, then the error
code is set to -ENOMEM which is correct. But if it fails in subsequent
iterations then "ret" is zero, which means success, but it should be
-ENOMEM.

Set the error code to -ENOMEM correctly.

Fixes: 7b5ab04f035f ("timekeeping: Fix resource leak in tk_aux_sysfs_init() error paths")
Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Malaya Kumar Rout <mrout@...hat.com>
Link: https://patch.msgid.link/aSW1R8q5zoY_DgQE@stanley.mountain
---
 kernel/time/timekeeping.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index 08e0943..4790da8 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -3073,8 +3073,10 @@ static int __init tk_aux_sysfs_init(void)
 		char id[2] = { [0] = '0' + i, };
 		struct kobject *clk = kobject_create_and_add(id, auxo);
 
-		if (!clk)
+		if (!clk) {
+			ret = -ENOMEM;
 			goto err_clean;
+		}
 
 		ret = sysfs_create_group(clk, &aux_clock_enable_attr_group);
 		if (ret)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ