Re: [PATCH v9 09/12] bpf/rqspinlock: switch check_timeout() to a clock interface
From: bot+bpf-ci@kernel.org
Date: 2026-02-09 03:05:47
Also in:
bpf, linux-arch, linux-pm, lkml
quoted hunk ↗ jump to hunk
diff --git a/kernel/bpf/rqspinlock.c b/kernel/bpf/rqspinlock.c index 2fdfa828e3d3..f02b1c5f0222 100644 --- a/kernel/bpf/rqspinlock.c +++ b/kernel/bpf/rqspinlock.c
[ ... ]
quoted hunk ↗ jump to hunk
@@ -340,6 +349,7 @@ int __lockfunc resilient_queued_spin_lock_slowpath(rqspinlock_t *lock, u32 val){ struct mcs_spinlock *prev, *next, *node; struct rqspinlock_timeout ts; + s64 timeout_err = 0; int idx, ret = 0; u32 old, tail;
[ ... ] In arch_mcs_spin_lock_contended(), when a waiter in the MCS queue receives a timeout signal (RES_TIMEOUT_VAL) from the previous waiter:
if (old & _Q_TAIL_MASK) {
int val;
prev = decode_tail(old, rqnodes);
/* Link @node into the waitqueue. */
WRITE_ONCE(prev->next, node);
val = arch_mcs_spin_lock_contended(&node->locked);
if (val == RES_TIMEOUT_VAL) {
ret = -ETIMEDOUT;
goto waitq_timeout;
}This sets ret = -ETIMEDOUT but does not set timeout_err. When execution reaches the waitq_timeout label:
waitq_timeout:
- if (ret) {
+ if (timeout_err < 0) {The condition evaluates to false since timeout_err is still 0. This causes the timeout handling to be skipped entirely, and execution falls through to the lock acquisition path. If the lock is acquired, the function returns ret (which is -ETIMEDOUT), making the caller believe the lock was not acquired when it actually was. This appears to be a lock leak. Should the goto waitq_timeout path also set timeout_err = -ETIMEDOUT? --- AI reviewed your patch. Please fix the bug or email reply why it's not a bug. See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md CI run summary: https://github.com/kernel-patches/bpf/actions/runs/21810635323 AI-authorship-score: low AI-authorship-explanation: The commit shows typical human developer patterns including a missed edge case during refactoring, which is a common human error rather than systematic AI-generated code issues. issues-found: 1 issue-severity-score: high issue-severity-explanation: Lock leak bug where the function may acquire a lock but return an error code, causing callers to think acquisition failed when it actually succeeded.