[PATCH] Fix oops in sysfs_hash_and_remove_file()
Changes
1 files changed · +4 −0
| File | Status | Add | Del | Content |
|---|---|---|---|---|
| fs/sysfs/inode.c | modified | +4 | −0 | View file |
fs/sysfs/inode.c
View filediff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index d727dc9..970a33f 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -228,6 +228,10 @@ void sysfs_hash_and_remove(struct dentry * dir, const char * name)
struct sysfs_dirent * sd;
struct sysfs_dirent * parent_sd = dir->d_fsdata;
+ if (dir->d_inode == NULL)
+ /* no inode means this hasn't been made visible yet */
+ return;
+
down(&dir->d_inode->i_sem);
list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
if (!sd->s_element)