summaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
authorChristopher Yeoh <cyeoh@au1.ibm.com>2012-05-31 19:26:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-31 20:49:32 -0400
commitac34ebb3a67e699edcb5ac72f19d31679369dfaa (patch)
tree21785208005952128545c0d7804c2dddf177766f /fs/compat.c
parentee62c6b2dc93c09585b51fad18449dc5edb9977f (diff)
aio/vfs: cleanup of rw_copy_check_uvector() and compat_rw_copy_check_uvector()
A cleanup of rw_copy_check_uvector and compat_rw_copy_check_uvector after changes made to support CMA in an earlier patch. Rather than having an additional check_access parameter to these functions, the first paramater type is overloaded to allow the caller to specify CHECK_IOVEC_ONLY which means check that the contents of the iovec are valid, but do not check the memory that they point to. This is used by process_vm_readv/writev where we need to validate that a iovec passed to the syscall is valid but do not want to check the memory that it points to at this point because it refers to an address space in another process. Signed-off-by: Chris Yeoh <yeohc@au1.ibm.com> Reviewed-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/compat.c b/fs/compat.c
index 0781e619a62a..6556a9ce8a28 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -532,7 +532,7 @@ out:
532ssize_t compat_rw_copy_check_uvector(int type, 532ssize_t compat_rw_copy_check_uvector(int type,
533 const struct compat_iovec __user *uvector, unsigned long nr_segs, 533 const struct compat_iovec __user *uvector, unsigned long nr_segs,
534 unsigned long fast_segs, struct iovec *fast_pointer, 534 unsigned long fast_segs, struct iovec *fast_pointer,
535 struct iovec **ret_pointer, int check_access) 535 struct iovec **ret_pointer)
536{ 536{
537 compat_ssize_t tot_len; 537 compat_ssize_t tot_len;
538 struct iovec *iov = *ret_pointer = fast_pointer; 538 struct iovec *iov = *ret_pointer = fast_pointer;
@@ -579,7 +579,7 @@ ssize_t compat_rw_copy_check_uvector(int type,
579 } 579 }
580 if (len < 0) /* size_t not fitting in compat_ssize_t .. */ 580 if (len < 0) /* size_t not fitting in compat_ssize_t .. */
581 goto out; 581 goto out;
582 if (check_access && 582 if (type >= 0 &&
583 !access_ok(vrfy_dir(type), compat_ptr(buf), len)) { 583 !access_ok(vrfy_dir(type), compat_ptr(buf), len)) {
584 ret = -EFAULT; 584 ret = -EFAULT;
585 goto out; 585 goto out;
@@ -1094,7 +1094,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
1094 goto out; 1094 goto out;
1095 1095
1096 tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, 1096 tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
1097 UIO_FASTIOV, iovstack, &iov, 1); 1097 UIO_FASTIOV, iovstack, &iov);
1098 if (tot_len == 0) { 1098 if (tot_len == 0) {
1099 ret = 0; 1099 ret = 0;
1100 goto out; 1100 goto out;