Skip to content

Commit db8dd96

Browse files
vaverinhtejun
authored andcommitted
cgroup-v1: cgroup_pidlist_next should update position index
if seq_file .next fuction does not change position index, read after some lseek can generate unexpected output. # mount | grep cgroup # dd if=/mnt/cgroup.procs bs=1 # normal output ... 1294 1295 1296 1304 1382 584+0 records in 584+0 records out 584 bytes copied dd: /mnt/cgroup.procs: cannot skip to specified offset 83 <<< generates end of last line 1383 <<< ... and whole last line once again 0+1 records in 0+1 records out 8 bytes copied dd: /mnt/cgroup.procs: cannot skip to specified offset 1386 <<< generates last line anyway 0+1 records in 0+1 records out 5 bytes copied https://bugzilla.kernel.org/show_bug.cgi?id=206283 Signed-off-by: Vasily Averin <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent 0bf999f commit db8dd96

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

kernel/cgroup/cgroup-v1.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,7 @@ static void *cgroup_pidlist_next(struct seq_file *s, void *v, loff_t *pos)
471471
*/
472472
p++;
473473
if (p >= end) {
474+
(*pos)++;
474475
return NULL;
475476
} else {
476477
*pos = *p;

0 commit comments

Comments
 (0)