Skip to content
/ linux Public

Commit f130001

Browse files
axboeSasha Levin
authored andcommitted
io_uring/sync: validate passed in offset
[ Upstream commit 649dd18 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 7d99cbe commit f130001

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

io_uring/sync.c

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

6363
sync->off = READ_ONCE(sqe->off);
64+
if (sync->off < 0)
65+
return -EINVAL;
6466
sync->len = READ_ONCE(sqe->len);
6567
return 0;
6668
}

0 commit comments

Comments
 (0)