diff options
author | Alexey Dobriyan <adobriyan@gmail.com> | 2009-02-05 16:30:05 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-02-05 17:18:14 -0500 |
commit | f01d1d546abb2f4028b5299092f529eefb01253a (patch) | |
tree | 625a9f9923ae53cc9bf75cf46fcebbbeb8ac84a8 /fs/seq_file.c | |
parent | 33da8892a2f9e7d4b2d9a35fc80833ba2d2b1aa6 (diff) |
seq_file: fix big-enough lseek() + read()
lseek() further than length of the file will leave stale ->index
(second-to-last during iteration). Next seq_read() will not notice
that ->f_pos is big enough to return 0, but will print last item
as if ->f_pos is pointing to it.
Introduced in commit cb510b8172602a66467f3551b4be1911f5a7c8c2
aka "seq_file: more atomicity in traverse()".
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r-- | fs/seq_file.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c index 2716c12eacf5..5267098532bf 100644 --- a/fs/seq_file.c +++ b/fs/seq_file.c | |||
@@ -102,6 +102,7 @@ static int traverse(struct seq_file *m, loff_t offset) | |||
102 | p = m->op->next(m, p, &index); | 102 | p = m->op->next(m, p, &index); |
103 | } | 103 | } |
104 | m->op->stop(m, p); | 104 | m->op->stop(m, p); |
105 | m->index = index; | ||
105 | return error; | 106 | return error; |
106 | 107 | ||
107 | Eoverflow: | 108 | Eoverflow: |