public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] posix-timers: Release the acquired lock before returning
@ 2023-06-26 12:00 You Kangren
  2023-06-26 14:19 ` Thomas Gleixner
  2023-06-28 13:54 ` kernel test robot
  0 siblings, 2 replies; 3+ messages in thread
From: You Kangren @ 2023-06-26 12:00 UTC (permalink / raw)
  To: Thomas Gleixner, open list:POSIX CLOCKS and TIMERS
  Cc: opensource.kernel, youkangren

Release the acquired lock before returning to prevent errors

Signed-off-by: You Kangren <youkangren@vivo.com>
---
 kernel/time/posix-timers.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c
index b924f0f096fa..8ab383cba0af 100644
--- a/kernel/time/posix-timers.c
+++ b/kernel/time/posix-timers.c
@@ -599,6 +599,7 @@ static struct k_itimer *__lock_timer(timer_t timer_id, unsigned long *flags)
 		 */
 		if (timr->it_signal == current->signal) {
 			rcu_read_unlock();
+			spin_unlock_irqrestore(&timr->it_lock, *flags);
 			return timr;
 		}
 		spin_unlock_irqrestore(&timr->it_lock, *flags);
@@ -1066,9 +1067,10 @@ static void itimer_delete(struct k_itimer *timer)
 		 * do_exit() only for the last thread of the thread group.
 		 * So no other task can access and delete that timer.
 		 */
-		if (WARN_ON_ONCE(timer_wait_running(timer, &flags) != timer))
+		if (WARN_ON_ONCE(timer_wait_running(timer, &flags) != timer)) {
+			spin_unlock_irqrestore(&timer->it_lock, flags);
 			return;
-
+		}
 		goto retry_delete;
 	}
 	list_del(&timer->list);
-- 
2.39.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-06-28 13:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-26 12:00 [PATCH] posix-timers: Release the acquired lock before returning You Kangren
2023-06-26 14:19 ` Thomas Gleixner
2023-06-28 13:54 ` kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox