From 768e05571cb76cb9aa8fefd87f31110181966a1b Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 6 Mar 2023 12:54:33 +0100 Subject: [PATCH] 6.1-stable patches added patches: io_uring-mark-task-task_running-before-handling-resume-task-work.patch --- ...ing-before-handling-resume-task-work.patch | 39 +++++++++++++++++++ queue-6.1/series | 1 + 2 files changed, 40 insertions(+) create mode 100644 queue-6.1/io_uring-mark-task-task_running-before-handling-resume-task-work.patch diff --git a/queue-6.1/io_uring-mark-task-task_running-before-handling-resume-task-work.patch b/queue-6.1/io_uring-mark-task-task_running-before-handling-resume-task-work.patch new file mode 100644 index 00000000000..4ca18e86c8f --- /dev/null +++ b/queue-6.1/io_uring-mark-task-task_running-before-handling-resume-task-work.patch @@ -0,0 +1,39 @@ +From 2f2bb1ffc9983e227424d0787289da5483b0c74f Mon Sep 17 00:00:00 2001 +From: Jens Axboe +Date: Mon, 6 Feb 2023 08:20:46 -0700 +Subject: io_uring: mark task TASK_RUNNING before handling resume/task work + +From: Jens Axboe + +commit 2f2bb1ffc9983e227424d0787289da5483b0c74f upstream. + +Just like for task_work, set the task mode to TASK_RUNNING before doing +any potential resume work. We're not holding any locks at this point, +but we may have already set the task state to TASK_INTERRUPTIBLE in +preparation for going to sleep waiting for events. Ensure that we set it +back to TASK_RUNNING if we have work to process, to avoid warnings on +calling blocking operations with !TASK_RUNNING. + +Fixes: b5d3ae202fbf ("io_uring: handle TIF_NOTIFY_RESUME when checking for task_work") +Reported-by: kernel test robot +Link: https://lore.kernel.org/oe-lkp/202302062208.24d3e563-oliver.sang@intel.com +Signed-off-by: Jens Axboe +Signed-off-by: Greg Kroah-Hartman +--- + io_uring/io_uring.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/io_uring/io_uring.h ++++ b/io_uring/io_uring.h +@@ -261,8 +261,10 @@ static inline int io_run_task_work(void) + * notify work that needs processing. + */ + if (current->flags & PF_IO_WORKER && +- test_thread_flag(TIF_NOTIFY_RESUME)) ++ test_thread_flag(TIF_NOTIFY_RESUME)) { ++ __set_current_state(TASK_RUNNING); + resume_user_mode_work(NULL); ++ } + if (task_work_pending(current)) { + __set_current_state(TASK_RUNNING); + task_work_run(); diff --git a/queue-6.1/series b/queue-6.1/series index ec1d5d61448..577d72f4f16 100644 --- a/queue-6.1/series +++ b/queue-6.1/series @@ -689,3 +689,4 @@ ksmbd-do-not-allow-the-actual-frame-length-to-be-smaller-than-the-rfc1002-length ksmbd-fix-possible-memory-leak-in-smb2_lock.patch torture-fix-hang-during-kthread-shutdown-phase.patch arm-dts-exynos-correct-hdmi-phy-compatible-in-exynos4.patch +io_uring-mark-task-task_running-before-handling-resume-task-work.patch -- 2.47.3