gfs2-utils: master - fsck.gfs2: Fix a use-after-free in pass2

Bob Peterson rpeterso at fedoraproject.org
Thu Jan 15 18:34:50 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=9c750fe0f06a9ab1b7d36c68041d0a61d8cdcede
Commit:        9c750fe0f06a9ab1b7d36c68041d0a61d8cdcede
Parent:        9aedcc0e2e1d1b801bcb0b7d33d1f6e104fd400a
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Wed Jan 14 12:22:23 2015 -0600
Committer:     Bob Peterson <rpeterso at redhat.com>
CommitterDate: Wed Jan 14 14:35:20 2015 -0600

fsck.gfs2: Fix a use-after-free in pass2

This patch fixes a rare code path that's doing use-after-free
in pass2.
---
 gfs2/fsck/pass2.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/gfs2/fsck/pass2.c b/gfs2/fsck/pass2.c
index 27b7336..4ea322a 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1928,13 +1928,14 @@ int pass2(struct gfs2_sbd *sdp)
 			ip = fsck_load_inode(sdp, dirblk);
 			cur_blks = ip->i_di.di_blocks;
 			error = check_metatree(ip, &pass2_fxns);
-			fsck_inode_put(&ip);
 			if (error < 0) {
 				stack;
+				fsck_inode_put(&ip);
 				return error;
 			}
 			if (ip->i_di.di_blocks != cur_blks)
 				reprocess_inode(ip, "current");
+			fsck_inode_put(&ip);
 		}
 		error = check_dir(sdp, dirblk, &pass2_fxns);
 		if (skip_this_pass || fsck_abort) /* if asked to skip the rest */


More information about the cluster-commits mailing list