Skip to content

Commit 00d9e47

Browse files
committed
posix-cpu-timers: Always clear head pointer on dequeue
The head pointer in struct cpu_timer is checked to be NULL in posix_cpu_timer_del() when the delete raced with the exit cleanup. The works correctly as long as the timer is actually dequeued via posix_cpu_timers_exit*(). But if the timer was dequeued due to expiry the head pointer is still set and triggers the warning. In fact keeping the head pointer around after any dequeue is pointless as is has no meaning at all after that. Clear the head pointer always on dequeue and remove the unused requeue function while at it. Fixes: 60bda03 ("posix-cpu-timers: Utilize timerqueue for storage") Reported-by: [email protected] Signed-off-by: Thomas Gleixner <[email protected]> Reviewed-by: Frederic Weisbecker <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 5d2295f commit 00d9e47

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

include/linux/posix-timers.h

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,6 @@ struct cpu_timer {
7474
int firing;
7575
};
7676

77-
static inline bool cpu_timer_requeue(struct cpu_timer *ctmr)
78-
{
79-
return timerqueue_add(ctmr->head, &ctmr->node);
80-
}
81-
8277
static inline bool cpu_timer_enqueue(struct timerqueue_head *head,
8378
struct cpu_timer *ctmr)
8479
{
@@ -88,8 +83,10 @@ static inline bool cpu_timer_enqueue(struct timerqueue_head *head,
8883

8984
static inline void cpu_timer_dequeue(struct cpu_timer *ctmr)
9085
{
91-
if (!RB_EMPTY_NODE(&ctmr->node.node))
86+
if (ctmr->head) {
9287
timerqueue_del(ctmr->head, &ctmr->node);
88+
ctmr->head = NULL;
89+
}
9390
}
9491

9592
static inline u64 cpu_timer_getexpires(struct cpu_timer *ctmr)

0 commit comments

Comments
 (0)