tree f31e9a79a643cfba649637164a559d94b4183ccc
parent 657390d25d4241705cb4fc5b3b4ba5b30575dc17
author James Bottomley <[EMAIL PROTECTED]> Sat, 27 Aug 2005 08:34:17 -0700
committer Linus Torvalds <[EMAIL PROTECTED]> Sat, 27 Aug 2005 09:37:13 -0700

[PATCH] Fix oops in sysfs_hash_and_remove_file()

The problem arises if an entity in sysfs is created and removed without
ever having been made completely visible.  In SCSI this is triggered by
removing a device while it's initialising.

The problem appears to be that because it was never made visible in sysfs,
the sysfs dentry has a null d_inode which oopses when a reference is made
to it.  The solution is simply to check d_inode and assume the object was
never made visible (and thus doesn't need deleting) if it's NULL.

(akpm: possibly a stopgap for 2.6.13 scsi problems.  May not be the
long-term fix)

Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
Signed-off-by: Andrew Morton <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 fs/sysfs/inode.c |    4 ++++
 1 files changed, 4 insertions(+)

diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -228,6 +228,10 @@ void sysfs_hash_and_remove(struct dentry
        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;
        list_for_each_entry(sd, &parent_sd->s_children, s_sibling) {
                if (!sd->s_element)
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to