aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-01-03 21:39:32 -0500
committerDarrick J. Wong <darrick.wong@oracle.com>2017-01-03 21:39:32 -0500
commit7a21272b088894070391a94fdd1c67014020fa1d (patch)
tree7e027d557b0a726a76d9db6e7179c590473474e3
parent0c744ea4f77d72b3dcebb7a8f2684633ec79be88 (diff)
xfs: fix double-cleanup when CUI recovery fails
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>
-rw-r--r--fs/xfs/xfs_refcount_item.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/xfs_refcount_item.c b/fs/xfs/xfs_refcount_item.c
index fe86a668a57e..6e4c7446c3d4 100644
--- a/fs/xfs/xfs_refcount_item.c
+++ b/fs/xfs/xfs_refcount_item.c
@@ -526,13 +526,14 @@ xfs_cui_recover(
526 xfs_refcount_finish_one_cleanup(tp, rcur, error); 526 xfs_refcount_finish_one_cleanup(tp, rcur, error);
527 error = xfs_defer_finish(&tp, &dfops, NULL); 527 error = xfs_defer_finish(&tp, &dfops, NULL);
528 if (error) 528 if (error)
529 goto abort_error; 529 goto abort_defer;
530 set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags); 530 set_bit(XFS_CUI_RECOVERED, &cuip->cui_flags);
531 error = xfs_trans_commit(tp); 531 error = xfs_trans_commit(tp);
532 return error; 532 return error;
533 533
534abort_error: 534abort_error:
535 xfs_refcount_finish_one_cleanup(tp, rcur, error); 535 xfs_refcount_finish_one_cleanup(tp, rcur, error);
536abort_defer:
536 xfs_defer_cancel(&dfops); 537 xfs_defer_cancel(&dfops);
537 xfs_trans_cancel(tp); 538 xfs_trans_cancel(tp);
538 return error; 539 return error;