From: Vasily Averin Date: Thu, 23 Jan 2020 09:05:10 +0000 (+0300) Subject: jbd2_seq_info_next should increase position index X-Git-Tag: v4.19.103~91 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68e81e14ddb897d5392cb4967ac398b52435adea;p=thirdparty%2Fkernel%2Fstable.git jbd2_seq_info_next should increase position index commit 1a8e9cf40c9a6a2e40b1e924b13ed303aeea4418 upstream. if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output. Script below generates endless output $ q=;while read -r r;do echo "$((++q)) $r";done Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/d13805e5-695e-8ac3-b678-26ca2313629f@virtuozzo.com Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c index df390a69c49a8..1a2339f2cb49b 100644 --- a/fs/jbd2/journal.c +++ b/fs/jbd2/journal.c @@ -1002,6 +1002,7 @@ static void *jbd2_seq_info_start(struct seq_file *seq, loff_t *pos) static void *jbd2_seq_info_next(struct seq_file *seq, void *v, loff_t *pos) { + (*pos)++; return NULL; }