dect
/
linux-2.6
Archived
13
0
Fork 0

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 cb510b8172
aka "seq_file: more atomicity in traverse()".

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alexey Dobriyan 2009-02-06 00:30:05 +03:00 committed by Linus Torvalds
parent 33da8892a2
commit f01d1d546a
1 changed files with 1 additions and 0 deletions

View File

@ -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: