diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2013-04-24 14:33:46 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2013-04-24 14:33:54 -0400 |
commit | 6402c7dc2a19c19bd8cdc7d80878b850da418942 (patch) | |
tree | cda2ea2df40442e2aa016119f3548cc504127ea8 /fs/compat.c | |
parent | 77c675ba18836802f6b73d2d773481d06ebc0f04 (diff) | |
parent | 60d509fa6a9c4653a86ad830e4c4b30360b23f0e (diff) |
Merge branch 'linus' into timers/core
Reason: Get upstream fixes before adding conflicting code.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'fs/compat.c')
-rw-r--r-- | fs/compat.c | 15 |
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, | |||
558 | } | 558 | } |
559 | *ret_pointer = iov; | 559 | *ret_pointer = iov; |
560 | 560 | ||
561 | ret = -EFAULT; | ||
562 | if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
563 | goto out; | ||
564 | |||
561 | /* | 565 | /* |
562 | * Single unix specification: | 566 | * Single unix specification: |
563 | * We should -EINVAL if an element length is not >= 0 and fitting an | 567 | * 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, | |||
1080 | if (!file->f_op) | 1084 | if (!file->f_op) |
1081 | goto out; | 1085 | goto out; |
1082 | 1086 | ||
1083 | ret = -EFAULT; | 1087 | ret = compat_rw_copy_check_uvector(type, uvector, nr_segs, |
1084 | if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector))) | ||
1085 | goto out; | ||
1086 | |||
1087 | tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs, | ||
1088 | UIO_FASTIOV, iovstack, &iov); | 1088 | UIO_FASTIOV, iovstack, &iov); |
1089 | if (tot_len == 0) { | 1089 | if (ret <= 0) |
1090 | ret = 0; | ||
1091 | goto out; | 1090 | goto out; |
1092 | } | ||
1093 | 1091 | ||
1092 | tot_len = ret; | ||
1094 | ret = rw_verify_area(type, file, pos, tot_len); | 1093 | ret = rw_verify_area(type, file, pos, tot_len); |
1095 | if (ret < 0) | 1094 | if (ret < 0) |
1096 | goto out; | 1095 | goto out; |