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

Andrew Price andyp at fedoraproject.org
Tue Apr 7 21:23:29 UTC 2015


Gitweb:        http://git.fedorahosted.org/git/?p=gfs2-utils.git;a=commitdiff;h=3ef35f4d0deeabfe9fdbc7939ae8dc6ae7dfb11f
Commit:        3ef35f4d0deeabfe9fdbc7939ae8dc6ae7dfb11f
Parent:        f0956d61f856599d1215b13f4b6be6731110edee
Author:        Bob Peterson <rpeterso at redhat.com>
AuthorDate:    Wed Jan 14 12:22:23 2015 -0600
Committer:     Andrew Price <anprice at redhat.com>
CommitterDate: Wed Apr 1 16:51:35 2015 +0100

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 77bb888..74bcc26 100644
--- a/gfs2/fsck/pass2.c
+++ b/gfs2/fsck/pass2.c
@@ -1930,13 +1930,14 @@ int pass2(struct gfs2_sbd *sdp)
 			ip = fsck_load_inode(sdp, dirblk);
 			astate_save(ip, &as);
 			error = check_metatree(ip, &pass2_fxns);
-			fsck_inode_put(&ip);
 			if (error < 0) {
 				stack;
+				fsck_inode_put(&ip);
 				return error;
 			}
 			if (astate_changed(ip, &as))
 				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