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: c73ebb685f ("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>
This commit is contained in:
parent
41d3a6bd1d
commit
44df58d441
1 changed files with 8 additions and 8 deletions
|
|
@ -7518,6 +7518,14 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
|
||||||
break;
|
break;
|
||||||
} while (1);
|
} while (1);
|
||||||
|
|
||||||
|
if (uts) {
|
||||||
|
struct timespec64 ts;
|
||||||
|
|
||||||
|
if (get_timespec64(&ts, uts))
|
||||||
|
return -EFAULT;
|
||||||
|
timeout = timespec64_to_jiffies(&ts);
|
||||||
|
}
|
||||||
|
|
||||||
if (sig) {
|
if (sig) {
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT
|
||||||
if (in_compat_syscall())
|
if (in_compat_syscall())
|
||||||
|
|
@ -7531,14 +7539,6 @@ static int io_cqring_wait(struct io_ring_ctx *ctx, int min_events,
|
||||||
return ret;
|
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);
|
init_waitqueue_func_entry(&iowq.wq, io_wake_function);
|
||||||
iowq.wq.private = current;
|
iowq.wq.private = current;
|
||||||
INIT_LIST_HEAD(&iowq.wq.entry);
|
INIT_LIST_HEAD(&iowq.wq.entry);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue