Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
net: atm: fix update of position index in lec_seq_next
Browse files Browse the repository at this point in the history
The position index in leq_seq_next is not updated when the next
entry is fetched an no more entries are available. This causes
seq_file to report the following error:

"seq_file: buggy .next function lec_seq_next [lec] did not update
 position index"

Fix this by always updating the position index.

[ Note: this is an ancient 2002 bug, the sha is from the
  tglx/history repo ]

Fixes 4aea2cb ("[ATM]: Move lan seq_file ops to lec.c [1/3]")
Signed-off-by: Colin Ian King <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
Colin Ian King authored and kuba-moo committed Oct 31, 2020
1 parent 2b94f52 commit 2f71e00
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions net/atm/lec.c
Original file line number Diff line number Diff line change
Expand Up @@ -954,9 +954,8 @@ static void *lec_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct lec_state *state = seq->private;

v = lec_get_idx(state, 1);
*pos += !!PTR_ERR(v);
return v;
++*pos;
return lec_get_idx(state, 1);
}

static int lec_seq_show(struct seq_file *seq, void *v)
Expand Down

0 comments on commit 2f71e00

Please sign in to comment.