Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()
authorOliver Neukum <oliver@neukum.org>
Wed, 20 Dec 2006 09:52:44 +0000 (10:52 +0100)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 7 Feb 2007 18:37:13 +0000 (10:37 -0800)
commit94bebf4d1b8e7719f0f3944c037a21cfd99a4af7
tree25c6ba1836e74f608b4e434b4f0f4d5c28b11de1
parentcb986b749c7178422bfbc982cd30e04d5db54bbc
Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()

This patch prevents a race between IO and removing a file from sysfs.
It introduces a list of sysfs_buffers associated with a file at the inode.
Upon removal of a file the list is walked and the buffers marked orphaned.
IO to orphaned buffers fails with -ENODEV. The driver can safely free
associated data structures or be unloaded.

Signed-off-by: Oliver Neukum <oliver@neukum.name>
Acked-by: Maneesh Soni <maneesh@in.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/bin.c
fs/sysfs/dir.c
fs/sysfs/file.c
fs/sysfs/group.c
fs/sysfs/inode.c
fs/sysfs/mount.c
fs/sysfs/symlink.c
fs/sysfs/sysfs.h