Skip to content

Commit 649dd18

Browse files
committed
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: c992fe2 ("io_uring: add fsync support") Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 07f3c3a commit 649dd18

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

io_uring/sync.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ int io_fsync_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
6262
return -EINVAL;
6363

6464
sync->off = READ_ONCE(sqe->off);
65+
if (sync->off < 0)
66+
return -EINVAL;
6567
sync->len = READ_ONCE(sqe->len);
6668
req->flags |= REQ_F_FORCE_ASYNC;
6769
return 0;

0 commit comments

Comments
 (0)