summaryrefslogtreecommitdiff
path: root/fs/seq_file.c
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@gmail.com>2009-02-06 00:30:05 +0300
committerGreg Kroah-Hartman <gregkh@suse.de>2009-02-12 09:50:35 -0800
commit02354e2daffe5ffed2b128824daf6eced0e13688 (patch)
treebdb8e2f166082f7d941fc213416993cadd12df11 /fs/seq_file.c
parent5dcb80816382aac7b3e79a003f520fb3c0821e42 (diff)
downloadlinux-stable-02354e2daffe5ffed2b128824daf6eced0e13688.tar.gz
seq_file: fix big-enough lseek() + read()
commit f01d1d546abb2f4028b5299092f529eefb01253a upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/seq_file.c')
-rw-r--r--fs/seq_file.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/fs/seq_file.c b/fs/seq_file.c
index 9549b71737b0..3404ec8269c0 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)
p = m->op->next(m, p, &index);
}
m->op->stop(m, p);
+ m->index = index;
return error;
Eoverflow: