[patch 135/198] undo do_readv_writev() behavior change

From: akpm
Date: Tue Apr 12 2005 - 23:49:41 EST



From: Dave Hansen <haveblue@xxxxxxxxxx>

Bugme bug 4326: http://bugme.osdl.org/show_bug.cgi?id=4326 reports:

executing the systemcall readv with Bad argument
->len == -1) it gives out error EFAULT instead of EINVAL


Signed-off-by: Andrew Morton <akpm@xxxxxxxx>
---

25-akpm/fs/read_write.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff -puN fs/read_write.c~undo-do_readv_writev-behavior-change fs/read_write.c
--- 25/fs/read_write.c~undo-do_readv_writev-behavior-change 2005-04-12 03:21:36.081651656 -0700
+++ 25-akpm/fs/read_write.c 2005-04-12 03:21:36.084651200 -0700
@@ -467,10 +467,10 @@ static ssize_t do_readv_writev(int type,
void __user *buf = iov[seg].iov_base;
ssize_t len = (ssize_t)iov[seg].iov_len;

- if (unlikely(!access_ok(vrfy_dir(type), buf, len)))
- goto Efault;
if (len < 0) /* size_t not fitting an ssize_t .. */
goto out;
+ if (unlikely(!access_ok(vrfy_dir(type), buf, len)))
+ goto Efault;
tot_len += len;
if ((ssize_t)tot_len < 0) /* maths overflow on the ssize_t */
goto out;
_
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/