From: Alexey Dobriyan Date: Thu, 5 Feb 2009 21:30:05 +0000 (+0300) Subject: seq_file: fix big-enough lseek() + read() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=f01d1d546abb2f4028b5299092f529eefb01253a;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git 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 Signed-off-by: Linus Torvalds --- diff --git a/fs/seq_file.c b/fs/seq_file.c index 2716c12eacf..5267098532b 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: