Skip to content

Commit 44df58d

Browse files
Xiaoguang Wangaxboe
authored andcommitted
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. Fixes: c73ebb6 ("io_uring: add timeout support for io_uring_enter()") Signed-off-by: Xiaoguang Wang <xiaoguang.wang@linux.alibaba.com> Link: https://lore.kernel.org/r/20210914143852.9663-1-xiaoguang.wang@linux.alibaba.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 41d3a6b commit 44df58d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

fs/io_uring.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7518,6 +7518,14 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
75187518
break;
75197519
} while (1);
75207520

7521+
if (uts) {
7522+
struct timespec64 ts;
7523+
7524+
if (get_timespec64(&ts, uts))
7525+
return -EFAULT;
7526+
timeout = timespec64_to_jiffies(&ts);
7527+
}
7528+
75217529
if (sig) {
75227530
#ifdef CONFIG_COMPAT
75237531
if (in_compat_syscall())
@@ -7531,14 +7539,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
75317539
return ret;
75327540
}
75337541

7534-
if (uts) {
7535-
struct timespec64 ts;
7536-
7537-
if (get_timespec64(&ts, uts))
7538-
return -EFAULT;
7539-
timeout = timespec64_to_jiffies(&ts);
7540-
}
7541-
75427542
init_waitqueue_func_entry(&iowq.wq, io_wake_function);
75437543
iowq.wq.private = current;
75447544
INIT_LIST_HEAD(&iowq.wq.entry);

0 commit comments

Comments
 (0)