summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Biederman <ebiederm@xmission.com>2009-02-18 14:48:16 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-16 17:31:56 -0700
commit9df28cf540f6a4064baf73ff7468e57892f4c379 (patch)
tree39a7c959b5f1f9d6d0b3d5dfed6a82bab1d4a173 /include
parent77a63f3bfdb9bb88fca91cdb4b8ea4af57b00096 (diff)
seq_file: properly cope with pread
commit 8f19d472935c83d823fa4cf02bcc0a7b9952db30 upstream. Currently seq_read assumes that the offset passed to it is always the offset it passed to user space. In the case pread this assumption is broken and we do the wrong thing when presented with pread. To solve this I introduce an offset cache inside of struct seq_file so we know where our logical file position is. Then in seq_read if we try to read from another offset we reset our data structures and attempt to go to the offset user space wanted. [akpm@linux-foundation.org: restore FMODE_PWRITE] [pjt@google.com: seq_open needs its fmode opened up to take advantage of this] Signed-off-by: Eric Biederman <ebiederm@xmission.com> Cc: Alexey Dobriyan <adobriyan@gmail.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Paul Turner <pjt@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r--include/linux/seq_file.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index dc50bcc282a8..cbb25fccb7b9 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -19,6 +19,7 @@ struct seq_file {
size_t from;
size_t count;
loff_t index;
+ loff_t read_pos;
u64 version;
struct mutex lock;
const struct seq_operations *op;