]> git.proxmox.com Git - mirror_ubuntu-bionic-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)
committerSeth Forshee <seth.forshee@canonical.com>
Fri, 23 Feb 2018 14:27:27 +0000 (08:27 -0600)
commit88302d4bbb379f28f9e56ab2a9fefae1ce9a9742
tree4a8b4f418512e1cd1fe25ff7c549c10e141c1b18
parent4401a4ef1dc80d425824a918ceafe07b46fd57e0
seq_file: fix incomplete reset on read from zero offset

BugLink: http://bugs.launchpad.net/bugs/1751131
commit cf5eebae2cd28d37581507668605f4d23cd7218d upstream.

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: e522751d605d ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
fs/seq_file.c