linux-stable/fs/sysfs
Ming Lei bb2b0051d7 sysfs: check if one entry has been removed before freeing
It might be a kernel disaster if one sysfs entry is freed but
still referenced by sysfs tree.

Recently Dave and Sasha reported one use-after-free problem on
sysfs entry, and the problem has been troubleshooted with help
of debug message added in this patch.

Given sysfs_get_dirent/sysfs_put are exported APIs, even inside
sysfs they are called in many contexts(kobject/attribe add/delete,
inode init/drop, dentry lookup/release, readdir, ...), it is healthful
to check the removed flag before freeing one entry and dump message
if it is freeing without being removed first.

Cc: Dave Jones <davej@redhat.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Ming Lei <ming.lei@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-04-05 15:35:52 -07:00
..
bin.c hlist: drop the node parameter from iterators 2013-02-27 19:10:24 -08:00
dir.c sysfs: check if one entry has been removed before freeing 2013-04-05 15:35:52 -07:00
file.c Revert "sysfs: Convert print_symbol to %pSR" 2013-01-17 13:09:57 -08:00
group.c sysfs: Functions for adding/removing symlinks to/from attribute groups 2013-01-25 21:51:13 +01:00
inode.c avoid iput() from flusher thread 2012-05-28 09:54:45 -07:00
Kconfig kconfig: rename CONFIG_EMBEDDED to CONFIG_EXPERT 2011-01-20 17:02:05 -08:00
Makefile
mount.c userns: Restrict when proc and sysfs can be mounted 2013-03-27 07:50:08 -07:00
symlink.c sysfs: Functions for adding/removing symlinks to/from attribute groups 2013-01-25 21:51:13 +01:00
sysfs.h sysfs: Functions for adding/removing symlinks to/from attribute groups 2013-01-25 21:51:13 +01:00