aboutsummaryrefslogtreecommitdiffstats
path: root/fs/compat.c
diff options
context:
space:
mode:
authorAl Viro <viro@ZenIV.linux.org.uk>2012-08-20 15:28:00 +0100
committerBen Hutchings <ben@decadent.org.uk>2012-09-12 03:37:21 +0100
commit6e6abc0339f25e0f45d85fec27aef1e8fe358897 (patch)
tree2c48ffd42de8b4dc9e6daad4d5fa897ad0843ea8 /fs/compat.c
parenta2810e5462e83ee74a5d20b68b39daa1402a4e5e (diff)
downloadkernel_samsung_smdk4412-6e6abc0339f25e0f45d85fec27aef1e8fe358897.zip
kernel_samsung_smdk4412-6e6abc0339f25e0f45d85fec27aef1e8fe358897.tar.gz
kernel_samsung_smdk4412-6e6abc0339f25e0f45d85fec27aef1e8fe358897.tar.bz2
vfs: missed source of ->f_pos races
commit 0e665d5d1125f9f4ccff56a75e814f10f88861a2 upstream. compat_sys_{read,write}v() need the same "pass a copy of file->f_pos" thing as sys_{read,write}{,v}(). Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs/compat.c')
-rw-r--r--fs/compat.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/compat.c b/fs/compat.c
index c987875..e07a3d3 100644
--- a/fs/compat.c
+++ b/fs/compat.c
@@ -1174,11 +1174,14 @@ compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
struct file *file;
int fput_needed;
ssize_t ret;
+ loff_t pos;
file = fget_light(fd, &fput_needed);
if (!file)
return -EBADF;
- ret = compat_readv(file, vec, vlen, &file->f_pos);
+ pos = file->f_pos;
+ ret = compat_readv(file, vec, vlen, &pos);
+ file->f_pos = pos;
fput_light(file, fput_needed);
return ret;
}
@@ -1233,11 +1236,14 @@ compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
struct file *file;
int fput_needed;
ssize_t ret;
+ loff_t pos;
file = fget_light(fd, &fput_needed);
if (!file)
return -EBADF;
- ret = compat_writev(file, vec, vlen, &file->f_pos);
+ pos = file->f_pos;
+ ret = compat_writev(file, vec, vlen, &pos);
+ file->f_pos = pos;
fput_light(file, fput_needed);
return ret;
}