Skip to content

Commit

Permalink
jbd2_seq_info_next should increase position index
Browse files Browse the repository at this point in the history
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 </proc/fs/jbd2/DEV/info

https://bugzilla.kernel.org/show_bug.cgi?id=206283

Fixes: 1f4aace ("fs/seq_file.c: simplify seq_file iteration code and interface")
Cc: [email protected]
Signed-off-by: Vasily Averin <[email protected]>
Reviewed-by: Jan Kara <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Theodore Ts'o <[email protected]>
  • Loading branch information
vaverin authored and tytso committed Jan 25, 2020
1 parent 17c51d8 commit 1a8e9cf
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/jbd2/journal.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,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;
}

Expand Down

0 comments on commit 1a8e9cf

Please sign in to comment.