]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.12-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2025 09:42:22 +0000 (10:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 15 Jan 2025 09:42:22 +0000 (10:42 +0100)
added patches:
io_uring-don-t-touch-sqd-thread-off-tw-add.patch

queue-6.12/io_uring-don-t-touch-sqd-thread-off-tw-add.patch [new file with mode: 0644]
queue-6.12/series

diff --git a/queue-6.12/io_uring-don-t-touch-sqd-thread-off-tw-add.patch b/queue-6.12/io_uring-don-t-touch-sqd-thread-off-tw-add.patch
new file mode 100644 (file)
index 0000000..4dd2f1d
--- /dev/null
@@ -0,0 +1,45 @@
+From bd2703b42decebdcddf76e277ba76b4c4a142d73 Mon Sep 17 00:00:00 2001
+From: Pavel Begunkov <asml.silence@gmail.com>
+Date: Fri, 10 Jan 2025 20:36:45 +0000
+Subject: io_uring: don't touch sqd->thread off tw add
+
+From: Pavel Begunkov <asml.silence@gmail.com>
+
+commit bd2703b42decebdcddf76e277ba76b4c4a142d73 upstream.
+
+With IORING_SETUP_SQPOLL all requests are created by the SQPOLL task,
+which means that req->task should always match sqd->thread. Since
+accesses to sqd->thread should be separately protected, use req->task
+in io_req_normal_work_add() instead.
+
+Note, in the eyes of io_req_normal_work_add(), the SQPOLL task struct
+is always pinned and alive, and sqd->thread can either be the task or
+NULL. It's only problematic if the compiler decides to reload the value
+after the null check, which is not so likely.
+
+Cc: stable@vger.kernel.org
+Cc: Bui Quang Minh <minhquangbui99@gmail.com>
+Reported-by: lizetao <lizetao1@huawei.com>
+Fixes: 78f9b61bd8e54 ("io_uring: wake SQPOLL task when task_work is added to an empty queue")
+Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
+Link: https://lore.kernel.org/r/1cbbe72cf32c45a8fee96026463024cd8564a7d7.1736541357.git.asml.silence@gmail.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ io_uring/io_uring.c |    5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+--- a/io_uring/io_uring.c
++++ b/io_uring/io_uring.c
+@@ -1244,10 +1244,7 @@ static void io_req_normal_work_add(struc
+       /* SQPOLL doesn't need the task_work added, it'll run it itself */
+       if (ctx->flags & IORING_SETUP_SQPOLL) {
+-              struct io_sq_data *sqd = ctx->sq_data;
+-
+-              if (sqd->thread)
+-                      __set_notify_signal(sqd->thread);
++              __set_notify_signal(req->task);
+               return;
+       }
index b8ba0a2b93692bba10b3dd61f77e10a578fbcbbc..5dcdfbbeb8e4dfde3c7aa078ed1d7f6a38ebd2d6 100644 (file)
@@ -184,3 +184,4 @@ drm-xe-oa-uapi-define-and-parse-oa-sync-properties.patch
 drm-xe-oa-add-input-fence-dependencies.patch
 xe-oa-fix-query-mode-of-operation-for-oar-oac.patch
 drm-mediatek-only-touch-disp_reg_ovl_pitch_msb-if-af.patch
+io_uring-don-t-touch-sqd-thread-off-tw-add.patch