Commit c2ec6682 authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

aio: negative offset should return -EINVAL

An AIO read or write should return -EINVAL if the offset is negative.
This check matches the one in pread and pwrite.

This was found by the libaio test suite.
Signed-off-by: default avatarRusty Russell <>
Acked-by: default avatarZach Brown <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 7adfa2ff
......@@ -1329,6 +1329,10 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb)
/* This matches the pread()/pwrite() logic */
if (iocb->ki_pos < 0)
return -EINVAL;
do {
ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg],
iocb->ki_nr_segs - iocb->ki_cur_seg,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment