diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 4 | ||||
-rw-r--r-- | fs/compat.c | 7 | ||||
-rw-r--r-- | fs/read_write.c | 8 |
3 files changed, 11 insertions, 8 deletions
@@ -1387,13 +1387,13 @@ static ssize_t aio_setup_vectored_rw(int type, struct kiocb *kiocb, bool compat) | |||
1387 | ret = compat_rw_copy_check_uvector(type, | 1387 | ret = compat_rw_copy_check_uvector(type, |
1388 | (struct compat_iovec __user *)kiocb->ki_buf, | 1388 | (struct compat_iovec __user *)kiocb->ki_buf, |
1389 | kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec, | 1389 | kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec, |
1390 | &kiocb->ki_iovec); | 1390 | &kiocb->ki_iovec, 1); |
1391 | else | 1391 | else |
1392 | #endif | 1392 | #endif |
1393 | ret = rw_copy_check_uvector(type, | 1393 | ret = rw_copy_check_uvector(type, |
1394 | (struct iovec __user *)kiocb->ki_buf, | 1394 | (struct iovec __user *)kiocb->ki_buf, |
1395 | kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec, | 1395 | kiocb->ki_nbytes, 1, &kiocb->ki_inline_vec, |
1396 | &kiocb->ki_iovec); | 1396 | &kiocb->ki_iovec, 1); |
1397 | if (ret < 0) | 1397 | if (ret < 0) |
1398 | goto out; | 1398 | goto out; |
1399 | 1399 | ||
diff --git a/fs/compat.c b/fs/compat.c index 302e761bd0aa..c98787536bb8 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -546,7 +546,7 @@ out: | |||
546 | ssize_t compat_rw_copy_check_uvector(int type, | 546 | ssize_t compat_rw_copy_check_uvector(int type, |
547 | const struct compat_iovec __user *uvector, unsigned long nr_segs, | 547 | const struct compat_iovec __user *uvector, unsigned long nr_segs, |
548 | unsigned long fast_segs, struct iovec *fast_pointer, | 548 | unsigned long fast_segs, struct iovec *fast_pointer, |
549 | struct iovec **ret_pointer) | 549 | struct iovec **ret_pointer, int check_access) |
550 | { | 550 | { |
551 | compat_ssize_t tot_len; | 551 | compat_ssize_t tot_len; |
552 | struct iovec *iov = *ret_pointer = fast_pointer; | 552 | struct iovec *iov = *ret_pointer = fast_pointer; |
@@ -593,7 +593,8 @@ ssize_t compat_rw_copy_check_uvector(int type, | |||
593 | } | 593 | } |
594 | if (len < 0) /* size_t not fitting in compat_ssize_t .. */ | 594 | if (len < 0) /* size_t not fitting in compat_ssize_t .. */ |
595 | goto out; | 595 | goto out; |
596 | if (!access_ok(vrfy_dir(type), compat_ptr(buf), len)) { | 596 | if (check_access && |
597 | !access_ok(vrfy_dir(type), compat_ptr(buf), len)) { | ||
597 | ret = -EFAULT; | 598 | ret = -EFAULT; |
598 | goto out; | 599 | goto out; |
599 | } | 600 | } |
@@ -1107,7 +1108,7 @@ static ssize_t compat_do_readv_writev(int type, struct file *file, | |||
1107 | goto out; | 1108 | goto out; |
1108 | 1109 | ||
1109 | tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, | 1110 | tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, |
1110 | UIO_FASTIOV, iovstack, &iov); | 1111 | UIO_FASTIOV, iovstack, &iov, 1); |
1111 | if (tot_len == 0) { | 1112 | if (tot_len == 0) { |
1112 | ret = 0; | 1113 | ret = 0; |
1113 | goto out; | 1114 | goto out; |
diff --git a/fs/read_write.c b/fs/read_write.c index dfd125798791..5ad4248b0cd8 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -633,7 +633,8 @@ ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov, | |||
633 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, | 633 | ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, |
634 | unsigned long nr_segs, unsigned long fast_segs, | 634 | unsigned long nr_segs, unsigned long fast_segs, |
635 | struct iovec *fast_pointer, | 635 | struct iovec *fast_pointer, |
636 | struct iovec **ret_pointer) | 636 | struct iovec **ret_pointer, |
637 | int check_access) | ||
637 | { | 638 | { |
638 | unsigned long seg; | 639 | unsigned long seg; |
639 | ssize_t ret; | 640 | ssize_t ret; |
@@ -689,7 +690,8 @@ ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, | |||
689 | ret = -EINVAL; | 690 | ret = -EINVAL; |
690 | goto out; | 691 | goto out; |
691 | } | 692 | } |
692 | if (unlikely(!access_ok(vrfy_dir(type), buf, len))) { | 693 | if (check_access |
694 | && unlikely(!access_ok(vrfy_dir(type), buf, len))) { | ||
693 | ret = -EFAULT; | 695 | ret = -EFAULT; |
694 | goto out; | 696 | goto out; |
695 | } | 697 | } |
@@ -721,7 +723,7 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
721 | } | 723 | } |
722 | 724 | ||
723 | ret = rw_copy_check_uvector(type, uvector, nr_segs, | 725 | ret = rw_copy_check_uvector(type, uvector, nr_segs, |
724 | ARRAY_SIZE(iovstack), iovstack, &iov); | 726 | ARRAY_SIZE(iovstack), iovstack, &iov, 1); |
725 | if (ret <= 0) | 727 | if (ret <= 0) |
726 | goto out; | 728 | goto out; |
727 | 729 | ||