Skip to content

Commit 72786ff

Browse files
committed
posix-timers: Set k_itimer:: It_signal to NULL on exit()
Technically it's not required to set k_itimer::it_signal to NULL on exit() because there is no other thread anymore which could lookup the timer concurrently. Set it to NULL for consistency sake and add a comment to that effect. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Frederic Weisbecker <frederic@kernel.org> Link: https://lore.kernel.org/r/20230425183313.196462644@linutronix.de
1 parent 028cf5e commit 72786ff

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

kernel/time/posix-timers.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,6 +1101,14 @@ static void itimer_delete(struct k_itimer *timer)
11011101
}
11021102
list_del(&timer->list);
11031103

1104+
/*
1105+
* Setting timer::it_signal to NULL is technically not required
1106+
* here as nothing can access the timer anymore legitimately via
1107+
* the hash table. Set it to NULL nevertheless so that all deletion
1108+
* paths are consistent.
1109+
*/
1110+
WRITE_ONCE(timer->it_signal, NULL);
1111+
11041112
spin_unlock_irqrestore(&timer->it_lock, flags);
11051113
release_posix_timer(timer, IT_ID_SET);
11061114
}

0 commit comments

Comments
 (0)