public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Anna-Maria Behnsen <anna-maria@linutronix.de>
To: Jinjie Ruan <ruanjinjie@huawei.com>,
	frederic@kernel.org, tglx@linutronix.de, kuba@kernel.org,
	ruanjinjie@huawei.com, richardcochran@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] posix-clock: posix-clock: Fix unbalanced locking in pc_clock_settime()
Date: Tue, 22 Oct 2024 12:04:44 +0200	[thread overview]
Message-ID: <878qug78sj.fsf@somnus> (raw)
In-Reply-To: <20241018100748.706462-1-ruanjinjie@huawei.com>

Jinjie Ruan <ruanjinjie@huawei.com> writes:

> If get_clock_desc() succeeds, it calls fget() for the clockid's fd,
> and get the clk->rwsem read lock, so the error path should release
> the lock to make the lock balance and fput the clockid's fd to make
> the refcount balance and release the fd related reosurce.

There is a typo: reosurce

>
> However the below commit left the error path locked behind resulting in
> unbalanced locking. Check timespec64_valid_strict() before
> get_clock_desc() to fix it, because the "ts" is not changed
> after that.
>
> Fixes: d8794ac20a29 ("posix-clock: Fix missing timespec64 check in pc_clock_settime()")
> Acked-by: Richard Cochran <richardcochran@gmail.com>
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Acked-by: Anna-Maria Behnsen <anna-maria@linutronix.de>

      parent reply	other threads:[~2024-10-22 10:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-18 10:07 [PATCH v2] posix-clock: posix-clock: Fix unbalanced locking in pc_clock_settime() Jinjie Ruan
2024-10-18 23:26 ` Thomas Gleixner
2024-10-22 15:42   ` Paolo Abeni
2024-10-23 14:21     ` Paolo Abeni
2024-10-22 10:04 ` Anna-Maria Behnsen [this message]

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=878qug78sj.fsf@somnus \
    --to=anna-maria@linutronix.de \
    --cc=frederic@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    --cc=ruanjinjie@huawei.com \
    --cc=tglx@linutronix.de \
    /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