Commit 7a21272b authored by Darrick J. Wong's avatar Darrick J. Wong

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
Reported-by: default avatarDan Carpenter <>
Signed-off-by: default avatarDarrick J. Wong <>
parent 0c744ea4
......@@ -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;
xfs_refcount_finish_one_cleanup(tp, rcur, error);
return error;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment