From: Jeff Dike Date: Thu, 5 May 2005 23:15:34 +0000 (-0700) Subject: [PATCH] uml: hostfs failed mount handling X-Git-Tag: v2.6.12-rc4~84 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=51a141104a37369be2822f423ed4444aa34d26a2;p=linux-2.6 [PATCH] uml: hostfs failed mount handling This cleans up the error handling and fixes a crash if a hostfs mount fails. Signed-off-by: Jeff Dike Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c index e6c63d9cac..14a0d339d0 100644 --- a/fs/hostfs/hostfs_kern.c +++ b/fs/hostfs/hostfs_kern.c @@ -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: