]> git.baikalelectronics.ru Git - kernel.git/commit
seq_file: fix incomplete reset on read from zero offset
authorMiklos Szeredi <mszeredi@redhat.com>
Wed, 15 Nov 2017 10:34:58 +0000 (11:34 +0100)
committerAl Viro <viro@zeniv.linux.org.uk>
Sat, 20 Jan 2018 07:31:15 +0000 (02:31 -0500)
commit99b704f78651e4133db6dc00eea9cbb81998a88e
tree4eb7d05f8d94adf671ba5f8aa736b9f502e37d21
parent5c8888e164846819ab05baa6d844c7c027ac7b36
seq_file: fix incomplete reset on read from zero offset

When resetting iterator on a zero offset we need to discard any data
already in the buffer (count), and private state of the iterator (version).

For example this bug results in first line being repeated in /proc/mounts
if doing a zero size read before a non-zero size read.

Reported-by: Rich Felker <dalias@libc.org>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Fixes: a1c3cf53c95d ("seq_file: reset iterator to first record for zero offset")
Cc: <stable@vger.kernel.org> # v4.10
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/seq_file.c