]> git.ipfire.org Git - thirdparty/linux.git/commit
rqspinlock: Fix TAS fallback lock entry creation
authorKumar Kartikeya Dwivedi <memxor@gmail.com>
Thu, 22 Jan 2026 11:59:11 +0000 (03:59 -0800)
committerAlexei Starovoitov <ast@kernel.org>
Fri, 23 Jan 2026 18:03:49 +0000 (10:03 -0800)
commit82f3b142c99cf44c7b1e70b7720169c646b9760f
tree3cb699c79dee7b6420ed44fb4099fe634f2786e4
parenta32ae2658471dd87a2f7a438388ed7d9a5767212
rqspinlock: Fix TAS fallback lock entry creation

The TAS fallback can be invoked directly when queued spin locks are
disabled, and through the slow path when paravirt is enabled for queued
spin locks. In the latter case, the res_spin_lock macro will attempt the
fast path and already hold the entry when entering the slow path. This
will lead to creation of extraneous entries that are not released, which
may cause false positives for deadlock detection.

Fix this by always preceding invocation of the TAS fallback in every
case with the grabbing of the held lock entry, and add a comment to make
note of this.

Fixes: c9102a68c070 ("rqspinlock: Add a test-and-set fallback")
Reported-by: Amery Hung <ameryhung@gmail.com>
Signed-off-by: Kumar Kartikeya Dwivedi <memxor@gmail.com>
Tested-by: Amery Hung <ameryhung@gmail.com>
Link: https://lore.kernel.org/r/20260122115911.3668985-1-memxor@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
include/asm-generic/rqspinlock.h
kernel/bpf/rqspinlock.c