[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200801032004.44696.rusty@rustcorp.com.au>
Date: Thu, 3 Jan 2008 20:04:44 +1100
From: Rusty Russell <rusty@...tcorp.com.au>
To: bcrl@...ck.org
Cc: linux-aio@...ck.org, Andrew Morton <akpm@...l.org>,
linux-kernel@...r.kernel.org
Subject: [PATCH] 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@...tcorp.com.au>
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