Skip to content

Commit

Permalink
io_uring: fix missing sigmask restore in io_cqring_wait()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Xiaoguang Wang authored and Jens Axboe committed Sep 14, 2021
1 parent 41d3a6b commit 44df58d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions fs/io_uring.c
Original file line number Diff line number Diff line change
Expand Up @@ -7518,6 +7518,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())
Expand All @@ -7531,14 +7539,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);
Expand Down

0 comments on commit 44df58d

Please sign in to comment.