]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.1-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Oct 2024 08:36:18 +0000 (10:36 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 1 Oct 2024 08:36:18 +0000 (10:36 +0200)
added patches:
io_uring-sqpoll-do-not-put-cpumask-on-stack.patch

queue-6.1/io_uring-sqpoll-do-not-put-cpumask-on-stack.patch [new file with mode: 0644]
queue-6.1/series

diff --git a/queue-6.1/io_uring-sqpoll-do-not-put-cpumask-on-stack.patch b/queue-6.1/io_uring-sqpoll-do-not-put-cpumask-on-stack.patch
new file mode 100644 (file)
index 0000000..26091d4
--- /dev/null
@@ -0,0 +1,50 @@
+From 7f44beadcc11adb98220556d2ddbe9c97aa6d42d Mon Sep 17 00:00:00 2001
+From: Felix Moessbauer <felix.moessbauer@siemens.com>
+Date: Mon, 16 Sep 2024 13:11:50 +0200
+Subject: io_uring/sqpoll: do not put cpumask on stack
+
+From: Felix Moessbauer <felix.moessbauer@siemens.com>
+
+commit 7f44beadcc11adb98220556d2ddbe9c97aa6d42d upstream.
+
+Putting the cpumask on the stack is deprecated for a long time (since
+2d3854a37e8), as these can be big. Given that, change the on-stack
+allocation of allowed_mask to be dynamically allocated.
+
+Fixes: f011c9cf04c0 ("io_uring/sqpoll: do not allow pinning outside of cpuset")
+Signed-off-by: Felix Moessbauer <felix.moessbauer@siemens.com>
+Link: https://lore.kernel.org/r/20240916111150.1266191-1-felix.moessbauer@siemens.com
+Signed-off-by: Jens Axboe <axboe@kernel.dk>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ io_uring/sqpoll.c |   13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+--- a/io_uring/sqpoll.c
++++ b/io_uring/sqpoll.c
+@@ -395,15 +395,22 @@ __cold int io_sq_offload_create(struct i
+                       return 0;
+               if (p->flags & IORING_SETUP_SQ_AFF) {
+-                      struct cpumask allowed_mask;
++                      cpumask_var_t allowed_mask;
+                       int cpu = p->sq_thread_cpu;
+                       ret = -EINVAL;
+                       if (cpu >= nr_cpu_ids || !cpu_online(cpu))
+                               goto err_sqpoll;
+-                      cpuset_cpus_allowed(current, &allowed_mask);
+-                      if (!cpumask_test_cpu(cpu, &allowed_mask))
++                      ret = -ENOMEM;
++                      if (!alloc_cpumask_var(&allowed_mask, GFP_KERNEL))
+                               goto err_sqpoll;
++                      ret = -EINVAL;
++                      cpuset_cpus_allowed(current, allowed_mask);
++                      if (!cpumask_test_cpu(cpu, allowed_mask)) {
++                              free_cpumask_var(allowed_mask);
++                              goto err_sqpoll;
++                      }
++                      free_cpumask_var(allowed_mask);
+                       sqd->sq_cpu = cpu;
+               } else {
+                       sqd->sq_cpu = -1;
index 6e63f54c27a85d7846b4d90c6b715e16b1fc61f6..baf0663e3c70a589d743e1f32a4b973ea554b4dd 100644 (file)
@@ -295,3 +295,4 @@ vfio-pci-fix-potential-memory-leak-in-vfio_intx_enable.patch
 selinux-smack-don-t-bypass-permissions-check-in-inode_setsecctx-hook.patch
 drm-vmwgfx-prevent-unmapping-active-read-buffers.patch
 io_uring-sqpoll-retain-test-for-whether-the-cpu-is-valid.patch
+io_uring-sqpoll-do-not-put-cpumask-on-stack.patch