diff options
author | Al Viro <viro@ZenIV.linux.org.uk> | 2012-08-20 18:28:00 +0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2014-02-11 01:11:34 +0400 |
commit | 55d06a71c12b8e7dd05517d3893cc6b99cd3c189 (patch) | |
tree | 5d930d317c977c9241d8b763880a53b4bcbe9f2e | |
parent | 2b718efa69f2431de9df4b35e725316fa25d5310 (diff) | |
download | linux-55d06a71c12b8e7dd05517d3893cc6b99cd3c189.tar.xz |
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: Paul Gortmaker <paul.gortmaker@windriver.com>
-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 633e63c32aa7..388555d404bf 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1231,11 +1231,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; } @@ -1288,11 +1291,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; } |