Skip to content

Commit 89163f9

Browse files
vaverintorvalds
authored andcommitted
ipc/util.c: sysvipc_find_ipc() should increase position index
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 <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: Waiman Long <[email protected]> Cc: Davidlohr Bueso <[email protected]> Cc: Manfred Spraul <[email protected]> Cc: Al Viro <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: NeilBrown <[email protected]> Cc: Peter Oberparleiter <[email protected]> Cc: Steven Rostedt <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Linus Torvalds <[email protected]>
1 parent f4d74ef commit 89163f9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ipc/util.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,13 +764,13 @@ static struct kern_ipc_perm *sysvipc_find_ipc(struct ipc_ids *ids, loff_t pos,
764764
total++;
765765
}
766766

767+
*new_pos = pos + 1;
767768
if (total >= ids->in_use)
768769
return NULL;
769770

770771
for (; pos < ipc_mni; pos++) {
771772
ipc = idr_find(&ids->ipcs_idr, pos);
772773
if (ipc != NULL) {
773-
*new_pos = pos + 1;
774774
rcu_read_lock();
775775
ipc_lock_object(ipc);
776776
return ipc;

0 commit comments

Comments
 (0)