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
..
2009-01-22 13:16:01 +03:00
2009-01-22 13:15:56 +03:00
2009-01-22 13:15:56 +03:00
2009-01-22 13:16:01 +03:00
2009-01-22 13:15:57 +03:00
2009-01-22 13:15:57 +03:00
2009-01-22 13:16:01 +03:00
2009-01-22 13:15:58 +03:00
2009-03-10 15:55:11 -07:00
2009-01-22 13:15:57 +03:00
2009-03-11 12:04:18 -07:00
2009-01-22 13:15:58 +03:00
2009-01-22 13:15:57 +03:00
2009-01-22 13:15:57 +03:00
2009-01-22 13:15:59 +03:00
2009-01-22 13:15:55 +03:00
2009-01-22 13:15:54 +03:00
2009-03-22 11:28:37 -07:00
2009-01-22 13:15:55 +03:00
2009-01-22 13:15:58 +03:00
2009-01-22 13:15:59 +03:00
2009-01-22 13:15:53 +03:00
2009-01-22 13:15:59 +03:00
2009-01-22 13:16:01 +03:00
2009-01-22 13:15:59 +03:00
2009-01-29 16:34:30 +02:00
2009-01-22 13:15:55 +03:00
2009-03-22 11:28:37 -07:00
2008-12-31 18:07:43 -05:00
2009-01-03 11:45:54 -08:00
2009-02-06 17:34:07 -08:00
2009-03-14 21:06:52 +01:00
2009-02-07 08:46:18 +11:00
2009-01-16 18:02:10 +01:00
2009-02-07 08:46:18 +11:00
2009-03-12 16:20:24 -07:00
2009-02-07 08:46:18 +11:00
2009-01-22 13:16:01 +03:00
2009-02-17 14:02:08 -08:00
2009-02-18 15:37:53 -08:00
2009-03-12 16:20:23 -07:00
2009-02-18 15:37:53 -08:00