summaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
authorVasily Averin <vvs@virtuozzo.com>2020-04-10 14:34:13 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-29 16:31:13 +0200
commitcb0ab2beb9c7bd352813f365bb1a73527579b416 (patch)
treedd4162a504f0746812f26895e535b7aa94081a3d /ipc
parent550d3bc535e0d22eb90dbd91452874299203ca43 (diff)
downloadlinux-stable-cb0ab2beb9c7bd352813f365bb1a73527579b416.tar.gz
linux-stable-cb0ab2beb9c7bd352813f365bb1a73527579b416.tar.bz2
linux-stable-cb0ab2beb9c7bd352813f365bb1a73527579b416.zip
ipc/util.c: sysvipc_find_ipc() should increase position index
[ Upstream commit 89163f93c6f969da5811af5377cc10173583123b ] If seq_file .next function 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> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Acked-by: Waiman Long <longman@redhat.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Manfred Spraul <manfred@colorfullife.com> Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Ingo Molnar <mingo@redhat.com> Cc: NeilBrown <neilb@suse.com> Cc: Peter Oberparleiter <oberpar@linux.ibm.com> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/b7a20945-e315-8bb0-21e6-3875c14a8494@virtuozzo.com Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'ipc')
-rw-r--r--ipc/util.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/ipc/util.c b/ipc/util.c
index 0af05752969f..b111e792b312 100644
--- a/ipc/util.c
+++ b/ipc/util.c
@@ -735,13 +735,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 < IPCMNI; pos++) {
ipc = idr_find(&ids->ipcs_idr, pos);
if (ipc != NULL) {
- *new_pos = pos + 1;
rcu_read_lock();
ipc_lock_object(ipc);
return ipc;