VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   32 Branches   54 Tags
author: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> 2007-03-07 20:41:07 -0800 committer: Linus Torvalds <torvalds@woody.linux-foundation.org> 2007-03-08 07:38:21 -0800 commit: bca271136f06514253aa28c24c04fc23b88e971e parent: 0ce3c83a9c22f59937b86c80b478dfbffe54dbab
Commit Summary:
[PATCH] uml: hostfs: fix double free
Diffstat:
1 file changed, 4 insertions, 1 deletion
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index e965eb11d76f..6f10e43746f9 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -966,6 +966,9 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
 		goto out_put;
 
 	HOSTFS_I(root_inode)->host_filename = name;
+	/* Avoid that in the error path, iput(root_inode) frees again name through
+	 * hostfs_destroy_inode! */
+	name = NULL;
 
 	err = -ENOMEM;
 	sb->s_root = d_alloc_root(root_inode);
@@ -977,7 +980,7 @@ static int hostfs_fill_sb_common(struct super_block *sb, void *d, int silent)
                 /* No iput in this case because the dput does that for us */
                 dput(sb->s_root);
                 sb->s_root = NULL;
-		goto out_free;
+		goto out;
         }
 
 	return(0);