[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878rc65mrd.ffs@tglx>
Date: Mon, 26 Jun 2023 16:19:50 +0200
From: Thomas Gleixner <tglx@...utronix.de>
To: You Kangren <youkangren@...o.com>,
"open list:POSIX CLOCKS and TIMERS" <linux-kernel@...r.kernel.org>
Cc: opensource.kernel@...o.com, youkangren@...o.com
Subject: Re: [PATCH] posix-timers: Release the acquired lock before returning
On Mon, Jun 26 2023 at 20:00, You Kangren wrote:
> Release the acquired lock before returning to prevent errors
Seriously?
> @@ -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;
The name of this function is __lock_timer() so it better returns with
the timer locked, no?
> }
> 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);
There is no lock held in that case.
Thanks,
tglx
Powered by blists - more mailing lists