This is a note to let you know that I've just added the patch titled xfs: fix some memory leaks in log recovery to the 5.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: xfs-fix-some-memory-leaks-in-log-recovery.patch and it can be found in the queue-5.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Mon Sep 26 08:48:28 AM CEST 2022 From: Chandan Babu R <chandan.babu@xxxxxxxxxx> Date: Sat, 24 Sep 2022 18:26:49 +0530 Subject: xfs: fix some memory leaks in log recovery To: gregkh@xxxxxxxxxxxxxxxxxxx Cc: sashal@xxxxxxxxxx, mcgrof@xxxxxxxxxx, linux-xfs@xxxxxxxxxxxxxxx, stable@xxxxxxxxxxxxxxx, djwong@xxxxxxxxxx, chandan.babu@xxxxxxxxxx, amir73il@xxxxxxxxx, leah.rumancik@xxxxxxxxx Message-ID: <20220924125656.101069-13-chandan.babu@xxxxxxxxxx> From: "Darrick J. Wong" <darrick.wong@xxxxxxxxxx> commit 050552cbe06a3a9c3f977dcf11ff998ae1d5c2d5 upstream. 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 <darrick.wong@xxxxxxxxxx> Reviewed-by: Brian Foster <bfoster@xxxxxxxxxx> Acked-by: Darrick J. Wong <djwong@xxxxxxxxxx> Signed-off-by: Chandan Babu R <chandan.babu@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/xfs/xfs_log_recover.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1347,10 +1347,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)); @@ -5318,7 +5319,8 @@ xlog_do_recovery_pass( } else { XFS_ERROR_REPORT(__func__, XFS_ERRLEVEL_LOW, log->l_mp); - return -EFSCORRUPTED; + error = -EFSCORRUPTED; + goto bread_err1; } } Patches currently in stable-queue which might be from chandan.babu@xxxxxxxxxx are queue-5.4/xfs-refactor-agfl-length-computation-function.patch queue-5.4/xfs-use-bitops-interface-for-buf-log-item-ail-flag-check.patch queue-5.4/xfs-fix-an-abba-deadlock-in-xfs_rename.patch queue-5.4/maintainers-add-chandan-as-xfs-maintainer-for-5.4.y.patch queue-5.4/xfs-split-the-sunit-parameter-update-into-two-parts.patch queue-5.4/xfs-slightly-tweak-an-assert-in-xfs_fs_map_blocks.patch queue-5.4/xfs-fix-use-after-free-when-aborting-corrupt-attr-inactivation.patch queue-5.4/xfs-stabilize-insert-range-start-boundary-to-avoid-cow-writeback-race.patch queue-5.4/iomap-iomap-that-extends-beyond-eof-should-be-marked-dirty.patch queue-5.4/xfs-constify-the-buffer-pointer-arguments-to-error-functions.patch queue-5.4/xfs-attach-dquots-and-reserve-quota-blocks-during-unwritten-conversion.patch queue-5.4/xfs-range-check-ri_cnt-when-recovering-log-items.patch queue-5.4/xfs-fix-deadlock-between-agi-and-agf-when-target_ip-exists-in-xfs_rename.patch queue-5.4/xfs-replace-eio-with-efscorrupted-for-corrupt-metadata.patch queue-5.4/xfs-convert-eio-to-efscorrupted-when-log-contents-are-invalid.patch queue-5.4/xfs-add-missing-assert-in-xfs_fsmap_owner_from_rmap.patch queue-5.4/xfs-always-log-corruption-errors.patch queue-5.4/xfs-fix-some-memory-leaks-in-log-recovery.patch queue-5.4/xfs-don-t-commit-sunit-swidth-updates-to-disk-if-that-would-cause-repair-failures.patch