diff options
author | Eric W. Biederman <ebiederm@aristanetworks.com> | 2009-03-04 14:57:20 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:38:26 -0400 |
commit | e0edd3c65aa5b53e20280565a7ce11675eb7ed6b (patch) | |
tree | e9d7a8834eba3f19635f770f5d19bfe88a2485e4 /fs/sysfs/sysfs.h | |
parent | ae1b41715ee2aae356fbcca032838b71d70b855f (diff) |
sysfs: don't block indefinitely for unmapped files.
Modify sysfs bin files so that we can remove the bin file while they are
still mapped. When the kobject is removed we unmap the bin file and
arrange for future accesses to the mapping to receive SIGBUS.
Implementing this prevents a nasty DOS when pci devices are hot plugged
and unplugged. Where if any of their resources were mmaped the kernel
could not free up their pci resources or release their pci data
structures.
[akpm@linux-foundation.org: remove unused var]
Signed-off-by: Eric W. Biederman <ebiederm@aristanetworks.com>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Acked-by: Tejun Heo <tj@kernel.org>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs/sysfs.h')
-rw-r--r-- | fs/sysfs/sysfs.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/sysfs/sysfs.h b/fs/sysfs/sysfs.h index 9055d04e4ab0..3fa0d98481e2 100644 --- a/fs/sysfs/sysfs.h +++ b/fs/sysfs/sysfs.h | |||
@@ -28,6 +28,7 @@ struct sysfs_elem_attr { | |||
28 | 28 | ||
29 | struct sysfs_elem_bin_attr { | 29 | struct sysfs_elem_bin_attr { |
30 | struct bin_attribute *bin_attr; | 30 | struct bin_attribute *bin_attr; |
31 | struct hlist_head buffers; | ||
31 | }; | 32 | }; |
32 | 33 | ||
33 | /* | 34 | /* |
@@ -164,6 +165,7 @@ int sysfs_add_file_mode(struct sysfs_dirent *dir_sd, | |||
164 | * bin.c | 165 | * bin.c |
165 | */ | 166 | */ |
166 | extern const struct file_operations bin_fops; | 167 | extern const struct file_operations bin_fops; |
168 | void unmap_bin_file(struct sysfs_dirent *attr_sd); | ||
167 | 169 | ||
168 | /* | 170 | /* |
169 | * symlink.c | 171 | * symlink.c |