From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Vasily Averin <vvs@virtuozzo.com>,
Cornelia Huck <cohuck@redhat.com>,
Christian Borntraeger <borntraeger@de.ibm.com>,
Vasily Gorbik <gor@linux.ibm.com>,
Sasha Levin <sashal@kernel.org>,
linux-s390@vger.kernel.org
Subject: [PATCH AUTOSEL 4.9 12/13] s390/cio: cio_ignore_proc_seq_next should increase position index
Date: Mon, 2 Mar 2020 21:50:01 -0500 [thread overview]
Message-ID: <20200303025002.10600-12-sashal@kernel.org> (raw)
In-Reply-To: <20200303025002.10600-1-sashal@kernel.org>
From: Vasily Averin <vvs@virtuozzo.com>
[ Upstream commit 8b101a5e14f2161869636ff9cb4907b7749dc0c2 ]
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.com
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
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 9082476b51db9..4e9f794176d35 100644
--- a/drivers/s390/cio/blacklist.c
+++ b/drivers/s390/cio/blacklist.c
@@ -302,8 +302,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) {
@@ -313,7 +315,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
return NULL;
} else
iter->devno++;
- (*offset)++;
return iter;
}
--
2.20.1
next prev parent reply other threads:[~2020-03-03 2:51 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-03 2:49 [PATCH AUTOSEL 4.9 01/13] serial: ar933x_uart: set UART_CS_{RX,TX}_READY_ORIDE Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 02/13] usb: gadget: composite: Support more than 500mA MaxPower Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 03/13] usb: gadget: ffs: ffs_aio_cancel(): Save/restore IRQ flags Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 04/13] usb: gadget: serial: fix Tx stall after buffer overflow Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 05/13] drm: msm: Fix return type of dsi_mgr_connector_mode_valid for kCFI Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 06/13] drm/msm/dsi: save pll state before dsi host is powered off Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 07/13] net: phy: restore mdio regs in the iproc mdio driver Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 08/13] net: ks8851-ml: Remove 8-bit bus accessors Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 09/13] net: ks8851-ml: Fix 16-bit data access Sasha Levin
2020-03-03 2:49 ` [PATCH AUTOSEL 4.9 10/13] net: ks8851-ml: Fix 16-bit IO operation Sasha Levin
2020-03-03 2:50 ` [PATCH AUTOSEL 4.9 11/13] watchdog: da9062: do not ping the hw during stop() Sasha Levin
2020-03-03 2:50 ` Sasha Levin [this message]
2020-03-03 2:50 ` [PATCH AUTOSEL 4.9 13/13] x86/boot/compressed: Don't declare __force_order in kaslr_64.c Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200303025002.10600-12-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=gor@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=vvs@virtuozzo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox