io_uring: fix overflows checks in provide buffers
authorPavel Begunkov <asml.silence@gmail.com>
Thu, 15 Apr 2021 12:07:39 +0000 (13:07 +0100)
committerJens Axboe <axboe@kernel.dk>
Sun, 18 Apr 2021 01:20:07 +0000 (19:20 -0600)
commit38134ada0ceea3e848fe993263c0ff6207fd46e7
tree2401b532fc9a60889a0a29d5736f312d91f2c6c9
parentc82d5bc703825a47af5c600e82e1e0c1db49e036
io_uring: fix overflows checks in provide buffers

Colin reported before possible overflow and sign extension problems in
io_provide_buffers_prep(). As Linus pointed out previous attempt did nothing
useful, see d81269fecb8ce ("io_uring: fix provide_buffers sign extension").

Do that with help of check_<op>_overflow helpers. And fix struct
io_provide_buf::len type, as it doesn't make much sense to keep it
signed.

Reported-by: Colin Ian King <colin.king@canonical.com>
Fixes: efe68c1ca8f49 ("io_uring: validate the full range of provided buffers for access")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/46538827e70fce5f6cdb50897cff4cacc490f380.1618488258.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c