Commit 2087009c authored by Ye Bin's avatar Ye Bin Committed by Jens Axboe

io_uring: validate timespec for timeout removals

Like commit f6223ff7, timeout removal should also validate the
timespec that is being passed in.
Signed-off-by: default avatarYe Bin <yebin10@huawei.com>
Link: https://lore.kernel.org/r/20211129041537.1936270-1-yebin10@huawei.comSigned-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent b6c7db32
...@@ -6111,6 +6111,8 @@ static int io_timeout_remove_prep(struct io_kiocb *req, ...@@ -6111,6 +6111,8 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
return -EINVAL; return -EINVAL;
if (get_timespec64(&tr->ts, u64_to_user_ptr(sqe->addr2))) if (get_timespec64(&tr->ts, u64_to_user_ptr(sqe->addr2)))
return -EFAULT; return -EFAULT;
if (tr->ts.tv_sec < 0 || tr->ts.tv_nsec < 0)
return -EINVAL;
} else if (tr->flags) { } else if (tr->flags) {
/* timeout removal doesn't support flags */ /* timeout removal doesn't support flags */
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment