public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-xfs@vger.kernel.org,
	"Darrick J. Wong" <darrick.wong@oracle.com>,
	Dan Carpenter <dan.carpenter@oracle.com>,
	Christoph Hellwig <hch@lst.de>
Subject: [PATCH 4.9 201/206] xfs: fix double-cleanup when CUI recovery fails
Date: Tue, 10 Jan 2017 14:38:04 +0100	[thread overview]
Message-ID: <20170110131512.314968855@linuxfoundation.org> (raw)
In-Reply-To: <20170110131502.767555407@linuxfoundation.org>

4.9-stable review patch.  If anyone has any objections, please let me know.

------------------


From: "Darrick J. Wong" <darrick.wong@oracle.com>

commit 7a21272b088894070391a94fdd1c67014020fa1d upstream.

Dan Carpenter reported a double-free of rcur if _defer_finish fails
while we're recovering CUI items.  Fix the error recovery to prevent
this.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 fs/xfs/xfs_refcount_item.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -526,13 +526,14 @@ xfs_cui_recover(
 	xfs_refcount_finish_one_cleanup(tp, rcur, error);
 	error = xfs_defer_finish(&tp, &dfops, NULL);
 	if (error)
-		goto abort_error;
+		goto abort_defer;
 	set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
 	error = xfs_trans_commit(tp);
 	return error;
 
 abort_error:
 	xfs_refcount_finish_one_cleanup(tp, rcur, error);
+abort_defer:
 	xfs_defer_cancel(&dfops);
 	xfs_trans_cancel(tp);
 	return error;



  parent reply	other threads:[~2017-01-10 13:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20170110131502.767555407@linuxfoundation.org>
2017-01-10 13:37 ` [PATCH 4.9 180/206] xfs: new inode extent list lookup helpers Greg Kroah-Hartman
2017-01-10 13:37 ` [PATCH 4.9 183/206] xfs: remove prev argument to xfs_bmapi_reserve_delalloc Greg Kroah-Hartman
2017-01-10 13:37 ` [PATCH 4.9 185/206] xfs: use new extent lookup helpers in __xfs_reflink_reserve_cow Greg Kroah-Hartman
2017-01-10 13:37 ` [PATCH 4.9 187/206] xfs: use new extent lookup helpers xfs_file_iomap_begin_delay Greg Kroah-Hartman
2017-01-10 13:38 ` Greg Kroah-Hartman [this message]
2017-01-10 13:38 ` [PATCH 4.9 202/206] xfs: use the actual AG length when reserving blocks Greg Kroah-Hartman
2017-01-10 13:38 ` [PATCH 4.9 203/206] xfs: fix crash and data corruption due to removal of busy COW extents Greg Kroah-Hartman

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=20170110131512.314968855@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=dan.carpenter@oracle.com \
    --cc=darrick.wong@oracle.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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