Patch "jbd2: avoid memleak in jbd2_journal_write_metadata_buffer" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    jbd2: avoid memleak in jbd2_journal_write_metadata_buffer

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:
     jbd2-avoid-memleak-in-jbd2_journal_write_metadata_bu.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.



commit d0a79948c1bef7a708aa94d79745092a9ca49234
Author: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
Date:   Tue May 14 19:24:30 2024 +0800

    jbd2: avoid memleak in jbd2_journal_write_metadata_buffer
    
    [ Upstream commit cc102aa24638b90e04364d64e4f58a1fa91a1976 ]
    
    The new_bh is from alloc_buffer_head, we should call free_buffer_head to
    free it in error case.
    
    Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
    Reviewed-by: Zhang Yi <yi.zhang@xxxxxxxxxx>
    Reviewed-by: Jan Kara <jack@xxxxxxx>
    Link: https://patch.msgid.link/20240514112438.1269037-2-shikemeng@xxxxxxxxxxxxxxx
    Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/jbd2/journal.c b/fs/jbd2/journal.c
index 81bd7b29a10b6..cfa21c29f3123 100644
--- a/fs/jbd2/journal.c
+++ b/fs/jbd2/journal.c
@@ -408,6 +408,7 @@ int jbd2_journal_write_metadata_buffer(transaction_t *transaction,
 		tmp = jbd2_alloc(bh_in->b_size, GFP_NOFS);
 		if (!tmp) {
 			brelse(new_bh);
+			free_buffer_head(new_bh);
 			return -ENOMEM;
 		}
 		jbd_lock_bh_state(bh_in);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux