]> git.baikalelectronics.ru Git - kernel.git/commit
cgroup-v1: cgroup_pidlist_next should update position index
authorVasily Averin <vvs@virtuozzo.com>
Thu, 30 Jan 2020 10:34:49 +0000 (13:34 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 1 Apr 2020 09:01:50 +0000 (11:01 +0200)
commit2f74c898fe669b69d1255035e1d048df397c6c17
tree24ca7ed3ae65033449eb0c500f707c95dcc83df8
parent04fac2ff21d039862b2fdc02697fc5b76c663ee8
cgroup-v1: cgroup_pidlist_next should update position index

[ Upstream commit 19af9b070cd6c691e694ff7904d3383b64e6810e ]

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 <vvs@virtuozzo.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/cgroup/cgroup-v1.c