diff options
author | Rafael J. Wysocki <rjw@sisk.pl> | 2007-06-13 14:45:18 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-07-11 19:09:07 -0400 |
commit | 9d9307dabb3de8140fb3801bf6eb01f231dbd83d (patch) | |
tree | 55cecd0eaefe5e3cc89f2aaf8542607f7d43ae8e /fs/sysfs | |
parent | 0c73f18b7d95de8a007039337063a770b5fc8e7a (diff) |
sysfs: Fix oops in sysfs_drop_dentry on x86_64
Fix oops on x86_64 caused by the dereference of dir in
sysfs_drop_dentry() made before checking if dir is not NULL
(cf. http://marc.info/?l=linux-kernel&m=118151626704924&w=2).
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/inode.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 732fd7f371e..ee31bf369a8 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -285,7 +285,7 @@ void sysfs_drop_dentry(struct sysfs_dirent *sd) | |||
285 | int sysfs_hash_and_remove(struct dentry * dir, const char * name) | 285 | int sysfs_hash_and_remove(struct dentry * dir, const char * name) |
286 | { | 286 | { |
287 | struct sysfs_dirent **pos, *sd; | 287 | struct sysfs_dirent **pos, *sd; |
288 | struct sysfs_dirent *parent_sd = dir->d_fsdata; | 288 | struct sysfs_dirent *parent_sd; |
289 | int found = 0; | 289 | int found = 0; |
290 | 290 | ||
291 | if (!dir) | 291 | if (!dir) |
@@ -295,6 +295,7 @@ int sysfs_hash_and_remove(struct dentry * dir, const char * name) | |||
295 | /* no inode means this hasn't been made visible yet */ | 295 | /* no inode means this hasn't been made visible yet */ |
296 | return -ENOENT; | 296 | return -ENOENT; |
297 | 297 | ||
298 | parent_sd = dir->d_fsdata; | ||
298 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); | 299 | mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT); |
299 | for (pos = &parent_sd->s_children; *pos; pos = &(*pos)->s_sibling) { | 300 | for (pos = &parent_sd->s_children; *pos; pos = &(*pos)->s_sibling) { |
300 | sd = *pos; | 301 | sd = *pos; |