diff options
| author | Paul E. McKenney <paulmck@kernel.org> | 2026-09-18 17:14:24 -0700 |
|---|---|---|
| committer | Thomas Gleixner <tglx@kernel.org> | 2026-09-29 21:02:52 +0200 |
| commit | 9cd2f4e304d921459a9348323aff518aee7fdc06 (patch) | |
| tree | 5a6682b08a54ac2d82e12feccd8aca6670042690 /kernel | |
| parent | 3990d196954a06cf9fb1bb4efd142d57c30a8e21 (diff) | |
| download | linux-next-9cd2f4e304d921459a9348323aff518aee7fdc06.tar.gz linux-next-9cd2f4e304d921459a9348323aff518aee7fdc06.zip | |
rtmutex: Use accessor for hrtimer_sleeper ->task field
The hrtimer_sleeper structure's ->task field is used as a flag to indicate
that the associated hrtimer has expired. This means that the hrtimer
handler can be storing to this field while other code is loading from it
to check for expiry. Note that additional races appear for hrtimers that
can be restarted, which could be argued to be a user error. However, that
is no reason to let the compiler introduce additional confusion, and to
this end, the hrtimer_sleeper_task_get() was introduced, use of which also
has the benefit of avoiding open-code access to hrtimer_sleeper innards.
Therefore, apply this accessor to rt_mutex_slowlock_block().
KCSAN located this issue.
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Reviewed-by: Dmitry Ilvokhin <d@ilvokhin.com>
Link: https://patch.msgid.link/20260919001428.3133388-8-paulmck@kernel.org
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/locking/rtmutex.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/locking/rtmutex.c b/kernel/locking/rtmutex.c index 4728631ae719..5a9534c715b8 100644 --- a/kernel/locking/rtmutex.c +++ b/kernel/locking/rtmutex.c @@ -1644,7 +1644,7 @@ static int __sched rt_mutex_slowlock_block(struct rt_mutex_base *lock, break; } - if (timeout && !timeout->task) { + if (timeout && !hrtimer_sleeper_task_get(timeout)) { ret = -ETIMEDOUT; break; } |
