]> err.no Git - linux-2.6/commitdiff
[PATCH] uml: hostfs failed mount handling
authorJeff Dike <jdike@addtoit.com>
Thu, 5 May 2005 23:15:34 +0000 (16:15 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 5 May 2005 23:36:37 +0000 (16:36 -0700)
This cleans up the error handling and fixes a crash if a hostfs mount fails.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/hostfs/hostfs_kern.c

index e6c63d9cac7bd473f8b7dd00734eea0682cf9658..14a0d339d0369f031a6eeb3905d086b1c31a52ab 100644 (file)
@@ -991,13 +991,17 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
                goto out_put;
 
        err = read_inode(root_inode);
-       if(err)
-               goto out_put;
+       if(err){
+                /* No iput in this case because the dput does that for us */
+                dput(sb->s_root);
+                sb->s_root = NULL;
+               goto out_free;
+        }
 
        return(0);
 
  out_put:
-       iput(root_inode);
+        iput(root_inode);
  out_free:
        kfree(name);
  out: