diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2017-01-09 10:39:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-01-12 05:39:44 -0500 |
commit | d9c7c9fa600acb0d587678cc71565316d11ec7ad (patch) | |
tree | cf1fa1782465694ea79a117a4c14def8d6ce79c5 | |
parent | aa38f370b25acc478be36e237e882e78f71c67e5 (diff) |
xfs: fix double-cleanup when CUI recovery fails
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>
-rw-r--r-- | fs/xfs/xfs_refcount_item.c | 3 |
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 | ||
534 | abort_error: | 534 | abort_error: |
535 | xfs_refcount_finish_one_cleanup(tp, rcur, error); | 535 | xfs_refcount_finish_one_cleanup(tp, rcur, error); |
536 | abort_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; |