From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
patches@lists.linux.dev, Chengfeng Lin <lin2530632123@gmail.com>,
Jens Axboe <axboe@kernel.dk>
Subject: [PATCH 7.2 14/82] io_uring/futex: dont mark futex wake requests as inflight
Date: Tue, 25 Aug 2026 15:25:01 +0200 [thread overview]
Message-ID: <20260825132542.084695461@linuxfoundation.org> (raw)
In-Reply-To: <20260825132541.560541185@linuxfoundation.org>
7.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jens Axboe <axboe@kernel.dk>
commit 73e7019097473fc9f83a334ef2c6ab3343709fef upstream.
Commit 079afb081c42 ("io_uring/futex: mark wait requests as inflight")
added inflight tracking to ensure that do_exit() ->
io_uring_files_cancel() finds and cancels pending futex waits before the
mm goes away, as a private futex wait depends on the mm private futex
hash staying alive for the duration of the request. However, as
io_futex_prep() is shared between FUTEX_WAIT and FUTEX_WAKE, wake
requests got marked as inflight as well.
A futex wake executes fully inline at issue time and never depends on
the mm staying alive after completion, hence there's no need to track
it. Kill it.
Cc: stable@vger.kernel.org
Fixes: 079afb081c42 ("io_uring/futex: mark wait requests as inflight")
Reported-by: Chengfeng Lin <lin2530632123@gmail.com>
Link: https://lore.kernel.org/io-uring/CANGjgdn=R_qyUdE=j9za+vkmqcxacbP-84OHXF4nZ4ho9qRyVg@mail.gmail.com/
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
io_uring/futex.c | 11 +++++++++++
io_uring/futex.h | 1 +
io_uring/opdef.c | 2 +-
3 files changed, 13 insertions(+), 1 deletion(-)
--- a/io_uring/futex.c
+++ b/io_uring/futex.c
@@ -149,6 +149,17 @@ int io_futex_prep(struct io_kiocb *req,
!futex_validate_input(iof->futex_flags, iof->futex_mask))
return -EINVAL;
+ return 0;
+}
+
+int io_futex_wait_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
+{
+ int ret;
+
+ ret = io_futex_prep(req, sqe);
+ if (unlikely(ret))
+ return ret;
+
/* Mark as inflight, so file exit cancelation will find it */
io_req_track_inflight(req);
return 0;
--- a/io_uring/futex.h
+++ b/io_uring/futex.h
@@ -3,6 +3,7 @@
#include "cancel.h"
int io_futex_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
+int io_futex_wait_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_futexv_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
int io_futex_wait(struct io_kiocb *req, unsigned int issue_flags);
int io_futexv_wait(struct io_kiocb *req, unsigned int issue_flags);
--- a/io_uring/opdef.c
+++ b/io_uring/opdef.c
@@ -467,7 +467,7 @@ const struct io_issue_def io_issue_defs[
},
[IORING_OP_FUTEX_WAIT] = {
#if defined(CONFIG_FUTEX)
- .prep = io_futex_prep,
+ .prep = io_futex_wait_prep,
.issue = io_futex_wait,
#else
.prep = io_eopnotsupp_prep,
next prev parent reply other threads:[~2026-08-25 13:29 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20260825132541.560541185@linuxfoundation.org>
2026-08-25 13:24 ` [PATCH 7.2 01/82] PCI: host-generic: Fix NULL pointer dereference on 32-bit CAM systems Greg Kroah-Hartman
2026-08-25 13:24 ` [PATCH 7.2 02/82] Bluetooth: RFCOMM: take rfcomm_mutex for the deferred setup accept Greg Kroah-Hartman
2026-08-25 13:24 ` [PATCH 7.2 10/82] futex: Sanitize and document task_struct::futex::state transitions Greg Kroah-Hartman
2026-08-25 13:24 ` [PATCH 7.2 11/82] futex/pi: Plug private futex exec() race Greg Kroah-Hartman
2026-08-25 13:24 ` [PATCH 7.2 12/82] futex: Avoid private hash use-after-free on final put Greg Kroah-Hartman
2026-08-25 13:25 ` [PATCH 7.2 13/82] futex: Fix race on the initial mm->futex.phash.ref allocation Greg Kroah-Hartman
2026-08-25 13:25 ` Greg Kroah-Hartman [this message]
2026-08-25 13:25 ` [PATCH 7.2 15/82] io_uring/futex: only mark private futex waits as inflight Greg Kroah-Hartman
2026-08-25 13:25 ` [PATCH 7.2 16/82] ALSA: dummy: Check card index validity at probe Greg Kroah-Hartman
2026-08-25 13:25 ` [PATCH 7.2 17/82] io_uring/cmd: fix iovec leak when the async cmd is not recycled Greg Kroah-Hartman
2026-08-25 13:25 ` [PATCH 7.2 18/82] io_uring/io-wq: fix worker accounting when canceling creation callbacks Greg Kroah-Hartman
2026-08-25 13:25 ` [PATCH 7.2 19/82] io_uring/rsrc: fix folio size overflow in io_vec_fill_bvec() Greg Kroah-Hartman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260825132542.084695461@linuxfoundation.org \
--to=gregkh@linuxfoundation.org \
--cc=axboe@kernel.dk \
--cc=lin2530632123@gmail.com \
--cc=patches@lists.linux.dev \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox