diff options
Diffstat (limited to 'fs')
-rw-r--r-- | fs/sysfs/dir.c | 1 | ||||
-rw-r--r-- | fs/sysfs/inode.c | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 49bd219275db..cfd290d3d6b1 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -302,6 +302,7 @@ void sysfs_remove_dir(struct kobject * kobj) | |||
302 | * Drop reference from dget() on entrance. | 302 | * Drop reference from dget() on entrance. |
303 | */ | 303 | */ |
304 | dput(dentry); | 304 | dput(dentry); |
305 | kobj->dentry = NULL; | ||
305 | } | 306 | } |
306 | 307 | ||
307 | int sysfs_rename_dir(struct kobject * kobj, const char *new_name) | 308 | int sysfs_rename_dir(struct kobject * kobj, const char *new_name) |
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c index 689f7bcfaf30..6beee6f6a674 100644 --- a/fs/sysfs/inode.c +++ b/fs/sysfs/inode.c | |||
@@ -227,12 +227,16 @@ void sysfs_drop_dentry(struct sysfs_dirent * sd, struct dentry * parent) | |||
227 | void sysfs_hash_and_remove(struct dentry * dir, const char * name) | 227 | void sysfs_hash_and_remove(struct dentry * dir, const char * name) |
228 | { | 228 | { |
229 | struct sysfs_dirent * sd; | 229 | struct sysfs_dirent * sd; |
230 | struct sysfs_dirent * parent_sd = dir->d_fsdata; | 230 | struct sysfs_dirent * parent_sd; |
231 | |||
232 | if (!dir) | ||
233 | return; | ||
231 | 234 | ||
232 | if (dir->d_inode == NULL) | 235 | if (dir->d_inode == NULL) |
233 | /* no inode means this hasn't been made visible yet */ | 236 | /* no inode means this hasn't been made visible yet */ |
234 | return; | 237 | return; |
235 | 238 | ||
239 | parent_sd = dir->d_fsdata; | ||
236 | mutex_lock(&dir->d_inode->i_mutex); | 240 | mutex_lock(&dir->d_inode->i_mutex); |
237 | list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { | 241 | list_for_each_entry(sd, &parent_sd->s_children, s_sibling) { |
238 | if (!sd->s_element) | 242 | if (!sd->s_element) |