seq_file: fix big-enough lseek() + read()
authorAlexey Dobriyan <adobriyan@gmail.com>
Thu, 5 Feb 2009 21:30:05 +0000 (00:30 +0300)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 5 Feb 2009 22:18:14 +0000 (14:18 -0800)
commit1c9fb214cd0642f00ab84bd9263d2779fb5e46ff
tree625a9f9923ae53cc9bf75cf46fcebbbeb8ac84a8
parent4f4f01f016187650cb3e395f3a2015dd21f281a3
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 5069a9adf8b3d9f23fdcd57df89d58b9b62d090d
aka "seq_file: more atomicity in traverse()".

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/seq_file.c