mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
io_uring/sync: validate passed in offset
Check if the passed in offset is negative once cast to sync->off. This
ensures that -EINVAL is returned for that case, like it would be for
sync_file_range(2).
Fixes: c992fe2925 ("io_uring: add fsync support")
Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
07f3c3a1cd
commit
649dd18f55
1 changed files with 2 additions and 0 deletions
|
|
@ -62,6 +62,8 @@ int io_fsync_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
|
|||
return -EINVAL;
|
||||
|
||||
sync->off = READ_ONCE(sqe->off);
|
||||
if (sync->off < 0)
|
||||
return -EINVAL;
|
||||
sync->len = READ_ONCE(sqe->len);
|
||||
req->flags |= REQ_F_FORCE_ASYNC;
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue