diff options
author | Alexey Izbyshev <izbyshev@ispras.ru> | 2024-04-05 15:55:51 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2024-04-27 17:12:47 +0200 |
commit | 9bb4c5655a78c2571cf6f7cb22e3afb576ff5ec0 (patch) | |
tree | bab797183dc572c9f1e6a0837d34419c8e8b2c71 /io_uring/io_uring.c | |
parent | 12dadc409c2bd8538c6ee0e56e191efde6d92007 (diff) | |
download | linux-stable-9bb4c5655a78c2571cf6f7cb22e3afb576ff5ec0.tar.gz linux-stable-9bb4c5655a78c2571cf6f7cb22e3afb576ff5ec0.tar.bz2 linux-stable-9bb4c5655a78c2571cf6f7cb22e3afb576ff5ec0.zip |
io_uring: Fix io_cqring_wait() not restoring sigmask on get_timespec64() failure
Commit 978e5c19dfefc271e5550efba92fcef0d3f62864 upstream.
This bug was introduced in commit 950e79dd7313 ("io_uring: minor
io_cqring_wait() optimization"), which was made in preparation for
adc8682ec690 ("io_uring: Add support for napi_busy_poll"). The latter
got reverted in cb3182167325 ("Revert "io_uring: Add support for
napi_busy_poll""), so simply undo the former as well.
Cc: stable@vger.kernel.org
Fixes: 950e79dd7313 ("io_uring: minor io_cqring_wait() optimization")
Signed-off-by: Alexey Izbyshev <izbyshev@ispras.ru>
Link: https://lore.kernel.org/r/20240405125551.237142-1-izbyshev@ispras.ru
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'io_uring/io_uring.c')
-rw-r--r-- | io_uring/io_uring.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/io_uring/io_uring.c b/io_uring/io_uring.c index 3fc792dfc6ae..dc0235ff472d 100644 --- a/io_uring/io_uring.c +++ b/io_uring/io_uring.c @@ -2610,19 +2610,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, if (__io_cqring_events_user(ctx) >= min_events) return 0; - if (sig) { -#ifdef CONFIG_COMPAT - if (in_compat_syscall()) - ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, - sigsz); - else -#endif - ret = set_user_sigmask(sig, sigsz); - - if (ret) - return ret; - } - init_waitqueue_func_entry(&iowq.wq, io_wake_function); iowq.wq.private = current; INIT_LIST_HEAD(&iowq.wq.entry); @@ -2639,6 +2626,19 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events, iowq.timeout = ktime_add_ns(timespec64_to_ktime(ts), ktime_get_ns()); } + if (sig) { +#ifdef CONFIG_COMPAT + if (in_compat_syscall()) + ret = set_compat_user_sigmask((const compat_sigset_t __user *)sig, + sigsz); + else +#endif + ret = set_user_sigmask(sig, sigsz); + + if (ret) + return ret; + } + trace_io_uring_cqring_wait(ctx, min_events); do { int nr_wait = (int) iowq.cq_tail - READ_ONCE(ctx->rings->cq.tail); |