From: Ye Bin Date: Mon, 29 Nov 2021 04:15:37 +0000 (+0800) Subject: io_uring: validate timespec for timeout removals X-Git-Tag: v6.1-rc5~2254^2~20 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2087009c74d41ab8579f08157bca55b7d0857ee5;p=platform%2Fkernel%2Flinux-starfive.git 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 Link: https://lore.kernel.org/r/20211129041537.1936270-1-yebin10@huawei.com Signed-off-by: Jens Axboe --- diff --git a/fs/io_uring.c b/fs/io_uring.c index 08b1b3d..8b6bfed 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;