From: Rusty Russell Date: Fri, 8 Feb 2008 12:20:15 +0000 (-0800) Subject: aio: negative offset should return -EINVAL X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c2ec66828fd253802abb912668f4bf9597e3c898;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git 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 Acked-by: Zach Brown Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/aio.c b/fs/aio.c index 26c1930889fa..b74c567383bc 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1329,6 +1329,10 @@ static ssize_t aio_rw_vect_retry(struct kiocb *iocb) opcode = IOCB_CMD_PWRITEV; } + /* 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,