cluster-devel.redhat.com archive mirror
 help / color / mirror / Atom feed
From: Bob Peterson <rpeterso@redhat.com>
To: cluster-devel.redhat.com
Subject: [Cluster-devel] [fsck.gfs2 PATCH] fsck.gfs2: Fix a use-after-free in pass2
Date: Thu, 15 Jan 2015 11:35:33 -0500 (EST)	[thread overview]
Message-ID: <241223034.10018414.1421339733794.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1763987001.10016993.1421339702066.JavaMail.zimbra@redhat.com>

Hi,

This patch fixes a rare code path that's doing use-after-free
I spotted in pass2.

Regards,

Bob Peterson
Red Hat File Systems

Signed-off-by: Bob Peterson <rpeterso@redhat.com> 
---
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 */



           reply	other threads:[~2015-01-15 16:35 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <1763987001.10016993.1421339702066.JavaMail.zimbra@redhat.com>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=241223034.10018414.1421339733794.JavaMail.zimbra@redhat.com \
    --to=rpeterso@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).