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 DE6FF23C4E9 for ; Mon, 15 Jun 2026 15:19:51 +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=1781536792; cv=none; b=lnsIsZcro8a4Z/A5WUwKgykPaGEgPPPRKiGdnrUUh8Bn9bQvjcpdMehJC6c0UGFoPTwPqhCX6sgDYH7Se4LNKYtt2P351Mvj6/ukNX1wTQLrVDdZp3sE6x+HMK7NuvtPYTk4wqCZQHU7ZsrjkZjht7kk3h6EO/GU5SuMo9hXYfg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781536792; c=relaxed/simple; bh=QqroYo2F/oTtrGs1IYccXp8GQ+7rksG7ftRUedilbX0=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=MMog3P/kPrdO3ETpx9NzX3IOQOJudywn/36qAVehyHuyGRPIUGF1eqtETv/gJaKa1K55yY3pN2/Vu5yx851kw7gF6blMcknLFcsOu6kawwXs7bqnCqwkP4u6VB8lffyNv6UkLb2XO9iS5Ys4S5gxS8s24i+3MUSyC8tcD60yTUQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=f53e+CtX; 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="f53e+CtX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D61561F000E9; Mon, 15 Jun 2026 15:19:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781536791; bh=5hgMAvuGogX7JJWjLHWURSarktmBnkOIQ+/JHMnxXgk=; h=Subject:To:Cc:From:Date; b=f53e+CtXNXDbV4steDtiaKpW+lCrMWDHyLGuAR+Hbcrgymns44V7Ym6Q3AArR4ibM TWC5VMWXvypyx7EgWNGpdgMW0Ky1q8A1tLGBUEOu1UnW6uNnUQ6CxJirBax+b8KjW0 g2a+blUq+e1cJnaOoUlRyJn6oMlsfVzWsKzjTe9w= Subject: FAILED: patch "[PATCH] futex/requeue: Prevent NULL pointer dereference in" failed to apply to 6.6-stable tree To: eilaimemedsnaimel@gmail.com,tglx@kernel.org Cc: From: Date: Mon, 15 Jun 2026 16:45:28 +0200 Message-ID: <2026061528-headband-manmade-880e@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 6.6-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-6.6.y git checkout FETCH_HEAD git cherry-pick -x 74e144274af39935b0f410c0ee4d2b91c3730414 # git commit -s git send-email --to '' --in-reply-to '2026061528-headband-manmade-880e@gregkh' --subject-prefix 'PATCH 6.6.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);