]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
futex/requeue: Revert "Prevent NULL pointer dereference in remove_waiter() on self...
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 1 Jul 2026 13:11:50 +0000 (15:11 +0200)
committerThomas Gleixner <tglx@kernel.org>
Thu, 2 Jul 2026 20:14:08 +0000 (22:14 +0200)
The commit cited below should not have been merged. It attemted to fix an
existing problem ansd thereby introduced new problems by keeping the
pi_state in state Q_REQUEUE_PI_IN_PROGRESS and leaking it.

Based on the commit description the intention was to handle the case
when task_blocks_on_rt_mutex() returns -EDEADLK and the following
remove_waiter() dereferences the NULL pointer in waiter->task.

That is already handled by Davidlohr in commit 40a25d59e85b3
("locking/rtmutex: Skip remove_waiter() when waiter is not enqueued") and
requires no further acting.

Revert the commit breaking the "waiter == owner" case again.

Fixes: 74e144274af39 ("futex/requeue: Prevent NULL pointer dereference in remove_waiter() on self-deadlock")
Reported-by: Michael Bommarito <michael.bommarito@gmail.com>
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20260701131150.0Ijhq4Dw@linutronix.de
Closes: https://lore.kernel.org/all/20260629020049.2082397-1-michael.bommarito@gmail.com
kernel/futex/requeue.c

index 7384672916fb6e7aa19c4b90ab33be4c239f28b6..79823ad136830a871b7fca255ebbf06d2f60c806 100644 (file)
@@ -645,12 +645,6 @@ retry_private:
                                continue;
                        }
 
-                       /* Self-deadlock: non-top waiter already owns the PI futex. */
-                       if (rt_mutex_owner(&pi_state->pi_mutex) == this->task) {
-                               ret = -EDEADLK;
-                               break;
-                       }
-
                        ret = rt_mutex_start_proxy_lock(&pi_state->pi_mutex,
                                                        this->rt_waiter,
                                                        this->task);