public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: You Kangren <youkangren@vivo.com>,
	"open list:POSIX CLOCKS and TIMERS"
	<linux-kernel@vger.kernel.org>
Cc: opensource.kernel@vivo.com, youkangren@vivo.com
Subject: Re: [PATCH] posix-timers: Release the acquired lock before returning
Date: Mon, 26 Jun 2023 16:19:50 +0200	[thread overview]
Message-ID: <878rc65mrd.ffs@tglx> (raw)
In-Reply-To: <20230626120017.3030-1-youkangren@vivo.com>

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

  reply	other threads:[~2023-06-26 14:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-26 12:00 [PATCH] posix-timers: Release the acquired lock before returning You Kangren
2023-06-26 14:19 ` Thomas Gleixner [this message]
2023-06-28 13:54 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=878rc65mrd.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=opensource.kernel@vivo.com \
    --cc=youkangren@vivo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox