diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2008-02-08 07:20:15 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2008-02-08 12:22:33 -0500 |
commit | c2ec66828fd253802abb912668f4bf9597e3c898 (patch) | |
tree | 6d7dfe34b423b5bf32a5a5ae6b35207db4bb5d22 /fs | |
parent | 7adfa2ff3efa02a7a9f2632d2d2662d3e5eb5304 (diff) |
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: Rusty Russell <rusty@rustcorp.com.au>
Acked-by: Zach Brown <zach.brown@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -1329,6 +1329,10 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb) | |||
1329 | opcode = IOCB_CMD_PWRITEV; | 1329 | opcode = IOCB_CMD_PWRITEV; |
1330 | } | 1330 | } |
1331 | 1331 | ||
1332 | /* This matches the pread()/pwrite() logic */ | ||
1333 | if (iocb->ki_pos < 0) | ||
1334 | return -EINVAL; | ||
1335 | |||
1332 | do { | 1336 | do { |
1333 | ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg], | 1337 | ret = rw_op(iocb, &iocb->ki_iovec[iocb->ki_cur_seg], |
1334 | iocb->ki_nr_segs - iocb->ki_cur_seg, | 1338 | iocb->ki_nr_segs - iocb->ki_cur_seg, |