[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <173094310370.32228.9829878952290850699.tip-bot2@tip-bot2>
Date: Thu, 07 Nov 2024 01:31:43 -0000
From: "tip-bot2 for Thomas Gleixner" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Frederic Weisbecker <frederic@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
linux-kernel@...r.kernel.org
Subject: [tip: timers/core] posix-cpu-timers: Correctly update timer status in
posix_cpu_timer_del()
The following commit has been merged into the timers/core branch of tip:
Commit-ID: 15cbfb92efee5c7f09e531a331e19759dbe0ac3c
Gitweb: https://git.kernel.org/tip/15cbfb92efee5c7f09e531a331e19759dbe0ac3c
Author: Thomas Gleixner <tglx@...utronix.de>
AuthorDate: Tue, 05 Nov 2024 09:14:29 +01:00
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Thu, 07 Nov 2024 02:14:43 +01:00
posix-cpu-timers: Correctly update timer status in posix_cpu_timer_del()
If posix_cpu_timer_del() exits early due to task not found or sighand
invalid, it fails to clear the state of the timer. That's harmless but
inconsistent.
These early exits are accounted as successful delete. Move the update of
the timer state into the success return path, so all "successful" deletions
are handled.
Reported-by: Frederic Weisbecker <frederic@...nel.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Frederic Weisbecker <frederic@...nel.org>
Link: https://lore.kernel.org/all/20241105064212.974053438@linutronix.de
---
kernel/time/posix-cpu-timers.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c
index 12f828d..5f444e3 100644
--- a/kernel/time/posix-cpu-timers.c
+++ b/kernel/time/posix-cpu-timers.c
@@ -493,20 +493,20 @@ static int posix_cpu_timer_del(struct k_itimer *timer)
*/
WARN_ON_ONCE(ctmr->head || timerqueue_node_queued(&ctmr->node));
} else {
- if (timer->it.cpu.firing) {
+ if (timer->it.cpu.firing)
ret = TIMER_RETRY;
- } else {
+ else
disarm_timer(timer, p);
- timer->it_status = POSIX_TIMER_DISARMED;
- }
unlock_task_sighand(p, &flags);
}
out:
rcu_read_unlock();
- if (!ret)
- put_pid(ctmr->pid);
+ if (!ret) {
+ put_pid(ctmr->pid);
+ timer->it_status = POSIX_TIMER_DISARMED;
+ }
return ret;
}
Powered by blists - more mailing lists