public inbox for linux-s390@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] cio_ignore_proc_seq_next should increase position index
@ 2020-01-24  5:48 Vasily Averin
  2020-01-24  9:24 ` Cornelia Huck
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Vasily Averin @ 2020-01-24  5:48 UTC (permalink / raw)
  To: linux-s390
  Cc: Sebastian Ott, Peter Oberparleiter, Heiko Carstens, Vasily Gorbik,
	Christian Borntraeger

if seq_file .next fuction does not change position index,
read after some lseek can generate unexpected output.

https://bugzilla.kernel.org/show_bug.cgi?id=206283
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
---
 drivers/s390/cio/blacklist.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
index 2a3f874..9cebff8 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -303,8 +303,10 @@ struct ccwdev_iter {
 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) {
@@ -314,7 +316,6 @@ struct ccwdev_iter {
 			return NULL;
 	} else
 		iter->devno++;
-	(*offset)++;
 	return iter;
 }
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-02-11 10:28 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-24  5:48 [PATCH 1/1] cio_ignore_proc_seq_next should increase position index Vasily Averin
2020-01-24  9:24 ` Cornelia Huck
2020-02-07 13:13 ` Christian Borntraeger
2020-02-10 17:13   ` Cornelia Huck
2020-02-11 10:19   ` Peter Oberparleiter
2020-02-11 10:21     ` Christian Borntraeger
2020-02-11 10:26 ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox