From: Ming Lei Date: Thu, 4 Apr 2013 14:22:37 +0000 (+0800) Subject: sysfs: check if one entry has been removed before freeing X-Git-Tag: omap-for-v3.10/dt-fixes-for-merge-window~138^2~6 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bb2b0051d7b0772ea9d0b4be900c2d965093f5d7;p=pandora-kernel.git 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 Cc: Sasha Levin Signed-off-by: Ming Lei Signed-off-by: Greg Kroah-Hartman --- Reading git-diff-tree failed