linux/fs/sysfs
Tejun Heo 43d3b56b2e sysfs: make sure read buffer is zeroed
commit f5c16f29bf upstream.

13c589d5b0 ("sysfs: use seq_file when reading regular files")
switched sysfs from custom read implementation to seq_file to enable
later transition to kernfs.  After the change, the buffer passed to
->show() is acquired through seq_get_buf(); unfortunately, this
introduces a subtle behavior change.  Before the commit, the buffer
passed to ->show() was always zero as it was allocated using
get_zeroed_page().  Because seq_file doesn't clear buffers on
allocation and neither does seq_get_buf(), after the commit, depending
on the behavior of ->show(), we may end up exposing uninitialized data
to userland thus possibly altering userland visible behavior and
leaking information.

Fix it by explicitly clearing the buffer.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Ron <ron@debian.org>
Fixes: 13c589d5b0 ("sysfs: use seq_file when reading regular files")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2014-06-07 10:28:24 -07:00
..
Kconfig
Makefile sysfs, kernfs: move inode code to fs/kernfs/inode.c 2013-11-29 17:55:10 -08:00
dir.c kernfs: add @mode to kernfs_create_dir[_ns]() 2013-12-17 08:59:15 -08:00
file.c sysfs: make sure read buffer is zeroed 2014-06-07 10:28:24 -07:00
group.c kernfs: add @mode to kernfs_create_dir[_ns]() 2013-12-17 08:59:15 -08:00
mount.c sysfs: fix namespace refcnt leak 2014-02-25 07:37:52 -08:00
symlink.c kernfs: s/sysfs/kernfs/ in constants 2013-12-11 17:39:20 -08:00
sysfs.h kernfs: s/sysfs_dirent/kernfs_node/ and rename its friends accordingly 2013-12-11 15:28:36 -08:00