From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EF70E4C9557 for ; Tue, 21 Jul 2026 15:13:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784646832; cv=none; b=HDYjvprFU3efci+NlaiMWXZDI0qvSxITw4Mk/5ir31A5LoFlUrDwjJgLk29Vlfvp6PQGXAGZ8GJdwrCYGNFkq1nqkzg4cue5EkBmj9Ni7uOAvw8J8EEIVgF3XCoY8xu6IMEClMbTA59YecRD+oWl9TMVq6w2dvx1BS9wt0mXTwA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784646832; c=relaxed/simple; bh=PnCpU+FbAvDdbwEscsNU91h/kVRtzriBcrxiGC0SGXw=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=ZMZamrvxC9oYKWKXN1iqQZKB+zJzH8FtuqhI50FdGbi/Rww3aNiYUlVsMy6FwzrQB8aocHLsaRyZQxqux+BUdkWYcUk5ooDYvYfI3W7Udchs1Z6WdEz9AFmRhfrQC7a7IydACeD1cj5WbHFjH78LvQn4bulK9EeFj7VStEChCpI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=A8dUWpe5; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="A8dUWpe5" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F6CE1F000E9; Tue, 21 Jul 2026 15:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784646830; bh=9R/c64CDu17pD7vrK1dO43Zmsidui6MH7VXYG7vuf/Y=; h=Subject:To:Cc:From:Date; b=A8dUWpe5WgBpIgj70nIelAbIAKAcz2co+HUAz2G7KzcJ9qeJk2c7WX7vHkWuZ5Tzp s7mJECia+VCMpt+0IQ45sp6Ln8PIx1TgWxOQcdtgmWJ1/qM11Byum0xDBwOyw4KzhC QGbEO/zhJAs1AwRiu7+yqVXiOG01hptpDzC+P4ro= Subject: FAILED: patch "[PATCH] futex/requeue: Prevent NULL pointer dereference in" failed to apply to 5.15-stable tree To: eilaimemedsnaimel@gmail.com,tglx@kernel.org Cc: From: Date: Tue, 21 Jul 2026 17:13:41 +0200 Message-ID: <2026072141-ravage-display-0696@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.15-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y git checkout FETCH_HEAD git cherry-pick -x 74e144274af39935b0f410c0ee4d2b91c3730414 # git commit -s git send-email --to '' --in-reply-to '2026072141-ravage-display-0696@gregkh' --subject-prefix 'PATCH 5.15.y' 'HEAD^..' Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 74e144274af39935b0f410c0ee4d2b91c3730414 Mon Sep 17 00:00:00 2001 From: Ji'an Zhou Date: Tue, 2 Jun 2026 09:12:04 +0000 Subject: [PATCH] futex/requeue: Prevent NULL pointer dereference in remove_waiter() on self-deadlock When FUTEX_CMP_REQUEUE_PI requeues a non-top waiter that already owns the target PI futex, task_blocks_on_rt_mutex() returns -EDEADLK before setting waiter->task. The subsequent remove_waiter() in rt_mutex_start_proxy_lock() dereferences the NULL waiter->task, causing a kernel crash. Add a self-deadlock check for non-top waiters before calling rt_mutex_start_proxy_lock(), analogous to the top-waiter check in futex_lock_pi_atomic(). Fixes: 3bfdc63936dd4773109b7b8c280c0f3b5ae7d349 ("rtmutex: Use waiter::task instead of current in remove_waiter()") Signed-off-by: Ji'an Zhou Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org diff --git a/kernel/futex/requeue.c b/kernel/futex/requeue.c index b597cb3d17fc..1d99a84dc9ad 100644 --- a/kernel/futex/requeue.c +++ b/kernel/futex/requeue.c @@ -643,6 +643,12 @@ int futex_requeue(u32 __user *uaddr1, unsigned int flags1, 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);