Skip to contentSkip to conversation

timer subsystem fix

GIT PULL Merged Ingo Molnar 2 participants 2 messages Nov 15, 2025 Posix clocks and timers

lore
Share & tools
lore
#0 lore raw

Linus,

Please pull the latest timers/urgent Git tree from:

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2025-11-15

# HEAD: e0fd4d42e27f761e9cc82801b3f183e658dc749d posix-timers: Plug potential memory leak in do_timer_create()

Fix a memory leak in the posix timer creation logic.

Thanks,

Ingo

------------------>
Eslam Khafagy (1):
posix-timers: Plug potential memory leak in do_timer_create()

 kernel/time/posix-timers.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
kernel/time/posix-timers.c +6 -6
index aa3120104a51..56e17b625c72 100644
@@ -475,12 +475,6 @@ static int do_timer_create(clockid_t which_clock, struct sigevent *event,
 	if (!kc->timer_create)
 		return -EOPNOTSUPP;
 
-	new_timer = alloc_posix_timer();
-	if (unlikely(!new_timer))
-		return -EAGAIN;
-
-	spin_lock_init(&new_timer->it_lock);
-
 	/* Special case for CRIU to restore timers with a given timer ID. */
 	if (unlikely(current->signal->timer_create_restore_ids)) {
 		if (copy_from_user(&req_id, created_timer_id, sizeof(req_id)))
@@ -490,6 +484,12 @@ static int do_timer_create(clockid_t which_clock, struct sigevent *event,
 			return -EINVAL;
 	}
 
+	new_timer = alloc_posix_timer();
+	if (unlikely(!new_timer))
+		return -EAGAIN;
+
+	spin_lock_init(&new_timer->it_lock);
+
 	/*
 	 * Add the timer to the hash table. The timer is not yet valid
 	 * after insertion, but has a unique ID allocated.
merge bot Merged
#1 lore raw
The pull request you sent on Sat, 15 Nov 2025 10:13:22 +0100:

The pull request you sent on Sat, 15 Nov 2025 10:13:22 +0100:

Quoted 1 line

git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git timers-urgent-2025-11-15

has been merged into torvalds/linux.git:
https://git.kernel.org/torvalds/c/bb1a6ddcfaa54b156e6e2ac61a986c4f5f8cb841

Thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/prtracker.html