Skip to content

Commit

Permalink
s390/cio: cio_ignore_proc_seq_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.

Link: https://bugzilla.kernel.org/show_bug.cgi?id=206283
Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Cornelia Huck <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
Signed-off-by: Vasily Averin <[email protected]>
Signed-off-by: Vasily Gorbik <[email protected]>
  • Loading branch information
vaverin authored and Vasily Gorbik committed Feb 17, 2020
1 parent 11a48a5 commit 8b101a5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/s390/cio/blacklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,10 @@ static void *
cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
{
struct ccwdev_iter *iter;
loff_t p = *offset;

if (*offset >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
(*offset)++;
if (p >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
return NULL;
iter = it;
if (iter->devno == __MAX_SUBCHANNEL) {
Expand All @@ -314,7 +316,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
return NULL;
} else
iter->devno++;
(*offset)++;
return iter;
}

Expand Down

0 comments on commit 8b101a5

Please sign in to comment.