summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYe Bin <yebin10@huawei.com>2021-11-29 12:15:37 +0800
committerJens Axboe <axboe@kernel.dk>2021-11-29 06:46:39 -0700
commit2087009c74d41ab8579f08157bca55b7d0857ee5 (patch)
tree3e4d11d26b1b72e758c6292bee83b928f1856ca3
parentb6c7db32183251204f124b10d6177d46558ca7b8 (diff)
io_uring: validate timespec for timeout removals
Like commit f6223ff79966, timeout removal should also validate the timespec that is being passed in. Signed-off-by: Ye Bin <yebin10@huawei.com> Link: https://lore.kernel.org/r/20211129041537.1936270-1-yebin10@huawei.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
-rw-r--r--fs/io_uring.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/io_uring.c b/fs/io_uring.c
index 08b1b3de9b3f..8b6bfed16f65 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6111,6 +6111,8 @@ static int io_timeout_remove_prep(struct io_kiocb *req,
return -EINVAL;
if (get_timespec64(&tr->ts, u64_to_user_ptr(sqe->addr2)))
return -EFAULT;
+ if (tr->ts.tv_sec < 0 || tr->ts.tv_nsec < 0)
+ return -EINVAL;
} else if (tr->flags) {
/* timeout removal doesn't support flags */
return -EINVAL;