aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-03-20 12:46:26 -0400
committerDavid S. Miller <davem@davemloft.net>2013-03-20 12:46:26 -0400
commit61816596d1c9026d0ecb20c44f90452c41596ffe (patch)
tree3027ed6dc62f71e14b9d525405747fa0eb8f074d /fs/compat.c
parentnet: fix psock_fanout selftest hash collision (diff)
parentnet: fec: Define indexes as 'unsigned int' (diff)
downloadlinux-dev-61816596d1c9026d0ecb20c44f90452c41596ffe.tar.xz
linux-dev-61816596d1c9026d0ecb20c44f90452c41596ffe.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull in the 'net' tree to get Daniel Borkmann's flow dissector infrastructure change. Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/compat.c b/fs/compat.c
index fe40fde29111..d487985dd0ea 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -558,6 +558,10 @@ ssize_t compat_rw_copy_check_uvector(int type,
}
*ret_pointer = iov;
+ ret = -EFAULT;
+ if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
+ goto out;
+
/*
* Single unix specification:
* We should -EINVAL if an element length is not >= 0 and fitting an
@@ -1080,17 +1084,12 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
if (!file->f_op)
goto out;
- ret = -EFAULT;
- if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
- goto out;
-
- tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
+ ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
UIO_FASTIOV, iovstack, &iov);
- if (tot_len == 0) {
- ret = 0;
+ if (ret <= 0)
goto out;
- }
+ tot_len = ret;
ret = rw_verify_area(type, file, pos, tot_len);
if (ret < 0)
goto out;