xfs: fix some memory leaks in log recovery
PATCH 1/1 xfs: fix some memory leaks in log recovery
From: Darrick J. Wong <[email protected]>
Fix a few places where we xlog_alloc_buffer a buffer, hit an error, and then bail out without freeing the buffer.
Signed-off-by Darrick J. Wong <[email protected]>
--- fs/xfs/xfs_log_recover.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/xfs_log_recover.c +5 -3
@@ -1342,10 +1342,11 @@ xlog_find_tail( error =xlog_rseek_logrec_hdr (log, *head_blk, *head_blk,1 , buffer, &rhead_blk, &rhead, &wrapped);if (error <0 ) -return error; + goto done;if (!error) {xfs_warn (log->l_mp,"%s: couldn't find sync record" , __func__); -return -EFSCORRUPTED ; + error = -EFSCORRUPTED ; + goto done; } *tail_blk =BLOCK_LSN (be64_to_cpu (rhead->h_tail_lsn));
@@ -5300,7 +5301,8 @@ xlog_do_recovery_pass( }else {XFS_ERROR_REPORT (__func__,XFS_ERRLEVEL_LOW , log->l_mp); -return -EFSCORRUPTED ; + error = -EFSCORRUPTED ; + goto bread_err1; } }
Quoted 7 lines · Darrick J. Wong
From: Darrick J. Wong <[email protected]>
Fix a few places where we
xlog_alloc_buffera buffer, hit an error, and then bail out without freeing the buffer.Signed-off-by Darrick J. Wong <[email protected]>---
Reviewed-by Brian Foster <[email protected]>
Quoted 32 lines
fs/xfs/xfs_log_recover.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)fs/xfs/xfs_log_recover.c +5
-3@@ -1342,10 +1342,11 @@ xlog_find_tail( error =xlog_rseek_logrec_hdr (log, *head_blk, *head_blk,1 , buffer, &rhead_blk, &rhead, &wrapped);if (error <0 ) -return error; + goto done;if (!error) {xfs_warn (log->l_mp,"%s: couldn't find sync record" , __func__); -return -EFSCORRUPTED ; + error = -EFSCORRUPTED ; + goto done; } *tail_blk =BLOCK_LSN (be64_to_cpu (rhead->h_tail_lsn));@@ -5300,7 +5301,8 @@ xlog_do_recovery_pass( }else {XFS_ERROR_REPORT (__func__,XFS_ERRLEVEL_LOW , log->l_mp); -return -EFSCORRUPTED ; + error = -EFSCORRUPTED ; + goto bread_err1; } }