[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <200801280955.39493.rusty@rustcorp.com.au>
Date: Mon, 28 Jan 2008 09:55:39 +1100
From: Rusty Russell <rusty@...tcorp.com.au>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: linux-kernel@...r.kernel.org, Zach Brown <zach.brown@...cle.com>
Subject: [PATCH 2/2] aio: -EINVAL on negative read/write offset
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@...tcorp.com.au>
---
fs/aio.c | 4 ++++
1 file changed, 4 insertions(+)
diff -r 18802689361a fs/aio.c
--- a/fs/aio.c Thu Jan 03 15:22:24 2008 +1100
+++ b/fs/aio.c Thu Jan 03 18:05:25 2008 +1100
@@ -1330,6 +1330,10 @@ static ssize_t aio_rw_vect_retry(struct
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,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists