Skip to content

Commit bb1a6dd

Browse files
committed
Merge tag 'timers-urgent-2025-11-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fix from Ingo Molnar: "Fix a memory leak in the posix timer creation logic" * tag 'timers-urgent-2025-11-15' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: posix-timers: Plug potential memory leak in do_timer_create()
2 parents fa3ade5 + e0fd4d4 commit bb1a6dd

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

kernel/time/posix-timers.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -475,12 +475,6 @@ static int do_timer_create(clockid_t which_clock, struct sigevent *event,
475475
if (!kc->timer_create)
476476
return -EOPNOTSUPP;
477477

478-
new_timer = alloc_posix_timer();
479-
if (unlikely(!new_timer))
480-
return -EAGAIN;
481-
482-
spin_lock_init(&new_timer->it_lock);
483-
484478
/* Special case for CRIU to restore timers with a given timer ID. */
485479
if (unlikely(current->signal->timer_create_restore_ids)) {
486480
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,
490484
return -EINVAL;
491485
}
492486

487+
new_timer = alloc_posix_timer();
488+
if (unlikely(!new_timer))
489+
return -EAGAIN;
490+
491+
spin_lock_init(&new_timer->it_lock);
492+
493493
/*
494494
* Add the timer to the hash table. The timer is not yet valid
495495
* after insertion, but has a unique ID allocated.

0 commit comments

Comments
 (0)