summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEugene Syromiatnikov <esyr@redhat.com>2022-04-06 14:55:33 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-13 21:59:22 +0300
commitfe223dd2f18b30dea66cee1174908a934e942e33 (patch)
treea0e0e6a27be53b81ebe4efe78a7dc36c8eddc862 /fs
parentae6cba337cbfda855b028f1e6ae83c22de4f5212 (diff)
downloadlinux-fe223dd2f18b30dea66cee1174908a934e942e33.tar.xz
io_uring: implement compat handling for IORING_REGISTER_IOWQ_AFF
commit 0f5e4b83b37a96e3643951588ed7176b9b187c0a upstream. Similarly to the way it is done im mbind syscall. Cc: stable@vger.kernel.org # 5.14 Fixes: fe76421d1da1dcdb ("io_uring: allow user configurable IO thread CPU affinity") Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/io_uring.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 6b71072f1408..a3a175965929 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -10683,7 +10683,15 @@ static int io_register_iowq_aff(struct io_ring_ctx *ctx, void __user *arg,
if (len > cpumask_size())
len = cpumask_size();
- if (copy_from_user(new_mask, arg, len)) {
+ if (in_compat_syscall()) {
+ ret = compat_get_bitmap(cpumask_bits(new_mask),
+ (const compat_ulong_t __user *)arg,
+ len * 8 /* CHAR_BIT */);
+ } else {
+ ret = copy_from_user(new_mask, arg, len);
+ }
+
+ if (ret) {
free_cpumask_var(new_mask);
return -EFAULT;
}