diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2012-08-20 15:28:00 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-09-14 10:00:05 -0700 |
commit | 1e6cec2253d5159a5f4e758114fd3c26a98b00a4 (patch) | |
tree | b02ab8d6ae2e4570ed435bacde973f99b3fb4232 | |
parent | 7b6d36dda04aaa8a87576ba5752e988448f88043 (diff) | |
download | linux-3.10-1e6cec2253d5159a5f4e758114fd3c26a98b00a4.tar.gz linux-3.10-1e6cec2253d5159a5f4e758114fd3c26a98b00a4.tar.bz2 linux-3.10-1e6cec2253d5159a5f4e758114fd3c26a98b00a4.zip |
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: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/compat.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/compat.c b/fs/compat.c index f2944ace7a7..2b371b38911 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1160,11 +1160,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; } @@ -1226,11 +1229,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; } |