kernel_optimize_test/fs/sysfs
Alex Chiang 669420644c sysfs: only allow one scheduled removal callback per kobj
The only way for a sysfs attribute to remove itself (without
deadlock) is to use the sysfs_schedule_callback() interface.

Vegard Nossum discovered that a poorly written sysfs ->store
callback can repeatedly schedule remove callbacks on the same
device over and over, e.g.

	$ while true ; do echo 1 > /sys/devices/.../remove ; done

If the 'remove' attribute uses the sysfs_schedule_callback API
and also does not protect itself from concurrent accesses, its
callback handler will be called multiple times, and will
eventually attempt to perform operations on a freed kobject,
leading to many problems.

Instead of requiring all callers of sysfs_schedule_callback to
implement their own synchronization, provide the protection in
the infrastructure.

Now, sysfs_schedule_callback will only allow one scheduled
callback per kobject. On subsequent calls with the same kobject,
return -EAGAIN.

This is a short term fix. The long term fix is to allow sysfs
attributes to remove themselves directly, without any of this
callback hokey pokey.

[cornelia.huck@de.ibm.com: s390 ccwgroup bits]

Reported-by: vegard.nossum@gmail.com
Signed-off-by: Alex Chiang <achiang@hp.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
2009-03-24 16:38:26 -07:00
..
bin.c sysfs: don't block indefinitely for unmapped files. 2009-03-24 16:38:26 -07:00
dir.c sysfs: don't block indefinitely for unmapped files. 2009-03-24 16:38:26 -07:00
file.c sysfs: only allow one scheduled removal callback per kobj 2009-03-24 16:38:26 -07:00
group.c Use WARN() in fs/sysfs 2008-07-26 12:00:07 -07:00
inode.c sysfs: reference sysfs_dirent from sysfs inodes 2009-03-24 16:38:25 -07:00
Kconfig fs/Kconfig: move sysfs out 2009-01-22 13:15:56 +03:00
Makefile
mount.c sysfs: reference sysfs_dirent from sysfs inodes 2009-03-24 16:38:25 -07:00
symlink.c driver core: Suppress sysfs warnings for device_rename(). 2008-07-21 21:55:01 -07:00
sysfs.h sysfs: don't block indefinitely for unmapped files. 2009-03-24 16:38:26 -07:00