Commit 6ea546ca authored by Vasily Averin's avatar Vasily Averin Committed by Kelsey Skunberg

s390/cio: cio_ignore_proc_seq_next should increase position index

BugLink: https://bugs.launchpad.net/bugs/1868628

[ Upstream commit 8b101a5e ]

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/d44c53a7-9bc1-15c7-6d4a-0c10cb9dffce@virtuozzo.comReviewed-by: default avatarCornelia Huck <cohuck@redhat.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: default avatarVasily Averin <vvs@virtuozzo.com>
Signed-off-by: default avatarVasily Gorbik <gor@linux.ibm.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarKelsey Skunberg <kelsey.skunberg@canonical.com>
parent 92f56fb3
...@@ -303,8 +303,10 @@ static void * ...@@ -303,8 +303,10 @@ static void *
cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset) cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
{ {
struct ccwdev_iter *iter; 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; return NULL;
iter = it; iter = it;
if (iter->devno == __MAX_SUBCHANNEL) { if (iter->devno == __MAX_SUBCHANNEL) {
...@@ -314,7 +316,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset) ...@@ -314,7 +316,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
return NULL; return NULL;
} else } else
iter->devno++; iter->devno++;
(*offset)++;
return iter; return iter;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment