io_uring: fix missing sigmask restore in io_cqring_wait()
PATCH 1/1 io_uring: fix missing sigmask restore in io_cqring_wait()
Move get_timespec() section in io_cqring_wait() before the sigmask saving, otherwise we'll fail to restore sigmask once get_timespec() returns error.
--- fs/io_uring.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
fs/io_uring.c +8 -8
@@ -7310,6 +7310,14 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,break ; }while (1 ); +if (uts) { +struct timespec64 ts; + +if (get_timespec64 (&ts, uts)) +return -EFAULT ; + timeout =timespec64_to_jiffies (&ts); + } +if (sig) {#ifdef CONFIG_COMPAT if (in_compat_syscall ())
@@ -7323,14 +7331,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,return ret; } -if (uts) { -struct timespec64 ts; - -if (get_timespec64 (&ts, uts)) -return -EFAULT ; - timeout =timespec64_to_jiffies (&ts); - } -init_waitqueue_func_entry (&iowq.wq, io_wake_function); iowq.wq.private = current;INIT_LIST_HEAD (&iowq.wq.entry);
Signature · 1 line
2.14.4.44.g2045bb6
Quoted 3 lines · Xiaoguang Wang
Move
get_timespec()section inio_cqring_wait()before the sigmask saving, otherwise we'll fail to restore sigmask onceget_timespec()returns error.
Applied, thanks! I added a:
to the commit since that's when it got broken, that'll help with stable backports. Not that it's a _huge_ issue, it basically means the application is broken anyway.
Signature · 1 line
Jens Axboe
hi,
Quoted 11 lines · Xiaoguang Wang
Quoted 3 lines
Move
get_timespec()section inio_cqring_wait()before the sigmask saving, otherwise we'll fail to restore sigmask onceget_timespec()returns error.Applied, thanks! I added a:
Fixes c73ebb685fb6 ("io_uring: add timeout support for io_uring_enter()")to the commit since that's when it got broken, that'll help with stable backports. Not that it's a _huge_ issue, it basically means the application is broken anyway.
Agree, thanks.
Regards,
Xiaoguang Wang