[PATCH 1/3] JFS: skip bad iput() call in error path

[email protected] Mon, 14 Jul 2008 11:48:12 -0500 (CDT)
Newsgroups gmane.comp.file-systems.jfs.patches
Message-ID <[email protected]>
JFS: skip bad iput() call in error path

If jfs_iget() fails, we can't call iput() on the returned error.
Thanks to Eric Sesterhenn's fuzzer testing for reporting the problem.

Signed-off-by: Dave Kleikamp <[email protected]>

---
commit 6536d2891ba2c4e837ba8478dc13bb173ed24a23
tree 22faac43152fb205f925bcec9c1c003573147a01
parent b2e03ca7485cac033a0667d9e45e28d32fdee9a5
author Dave Kleikamp <[email protected]> Wed, 21 May 2008 10:45:16 -0500
committer Dave Kleikamp <[email protected]> Wed, 21 May 2008 10:45:16 -0500

 fs/jfs/super.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/fs/jfs/super.c b/fs/jfs/super.c
index 50ea654..0288e6d 100644
--- a/fs/jfs/super.c
+++ b/fs/jfs/super.c
@@ -499,7 +499,7 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 	inode = jfs_iget(sb, ROOT_I);
 	if (IS_ERR(inode)) {
 		ret = PTR_ERR(inode);
-		goto out_no_root;
+		goto out_no_rw;
 	}
 	sb->s_root = d_alloc_root(inode);
 	if (!sb->s_root)
@@ -521,9 +521,8 @@ static int jfs_fill_super(struct super_block *sb, void *data, int silent)
 	return 0;
 
 out_no_root:
-	jfs_err("jfs_read_super: get root inode failed");
-	if (inode)
-		iput(inode);
+	jfs_err("jfs_read_super: get root dentry failed");
+	iput(inode);
 
 out_no_rw:
 	rc = jfs_umount(sb);

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08