linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/7] sysvipc_find_ipc should increase position index
@ 2020-01-24  7:03 Vasily Averin
  2020-01-24 16:26 ` Waiman Long
  2020-05-05 16:13 ` Andreas Schwab
  0 siblings, 2 replies; 14+ messages in thread
From: Vasily Averin @ 2020-01-24  7:03 UTC (permalink / raw)
  To: linux-kernel
  Cc: Andrew Morton, NeilBrown, Waiman Long, Steven Rostedt,
	Ingo Molnar, Peter Oberparleiter

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>
---
 ipc/util.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ipc/util.c b/ipc/util.c
index 915eacb..7a3ab2e 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -764,13 +764,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
 			total++;
 	}
 
+	*new_pos = pos + 1;
 	if (total >= ids->in_use)
 		return NULL;
 
 	for (; pos < ipc_mni; pos++) {
 		ipc = idr_find(&ids->ipcs_idr, pos);
 		if (ipc != NULL) {
-			*new_pos = pos + 1;
 			rcu_read_lock();
 			ipc_lock_object(ipc);
 			return ipc;
-- 
1.8.3.1


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

end of thread, other threads:[~2020-05-12 15:45 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-24  7:03 [PATCH 7/7] sysvipc_find_ipc should increase position index Vasily Averin
2020-01-24 16:26 ` Waiman Long
2020-02-25  6:35   ` Vasily Averin
2020-05-05 16:13 ` Andreas Schwab
2020-05-06  5:03   ` Vasily Averin
2020-05-06  6:25     ` [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates " Vasily Averin
2020-05-06 15:59       ` Waiman Long
2020-05-07 12:29         ` Vasily Averin
2020-05-08  0:02       ` Andrew Morton
2020-05-08  3:36         ` Matthew Wilcox
2020-05-08  6:07           ` Vasily Averin
2020-05-08 10:01             ` Vasily Averin
2020-05-12  9:21               ` Jiri Slaby
2020-05-12 15:45                 ` Vasily Averin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).