From: Rusty Russell <rusty@rustcorp.com.au>
To: bcrl@kvack.org
Cc: linux-aio@kvack.org, Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org
Subject: [PATCH] aio: negative offset should return -EINVAL
Date: Thu, 3 Jan 2008 20:04:44 +1100 [thread overview]
Message-ID: <200801032004.44696.rusty@rustcorp.com.au> (raw)
In-Reply-To: <200801032004.08907.rusty@rustcorp.com.au>
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>
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,
next prev parent reply other threads:[~2008-01-03 9:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-03 9:04 [PATCH] aio: partial write should not return error code Rusty Russell
2008-01-03 9:04 ` Rusty Russell [this message]
2008-01-03 20:17 ` [PATCH] aio: negative offset should return -EINVAL Zach Brown
2008-01-03 20:04 ` [PATCH] aio: partial write should not return error code Zach Brown
2008-01-04 3:10 ` Rusty Russell
2008-01-04 18:19 ` Zach Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200801032004.44696.rusty@rustcorp.com.au \
--to=rusty@rustcorp.com.au \
--cc=akpm@osdl.org \
--cc=bcrl@kvack.org \
--cc=linux-aio@kvack.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.