Patch "ext4: avoid buffer_head leak in ext4_mark_inode_used()" has been added to the 6.10-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

    ext4: avoid buffer_head leak in ext4_mark_inode_used()

to the 6.10-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:
     ext4-avoid-buffer_head-leak-in-ext4_mark_inode_used.patch
and it can be found in the queue-6.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bed9656c2d9a8475fa70fbb90e8a92bbf29e7f0d
Author: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
Date:   Tue Aug 20 21:22:28 2024 +0800

    ext4: avoid buffer_head leak in ext4_mark_inode_used()
    
    [ Upstream commit 5e5b2a56c57def1b41efd49596621504d7bcc61c ]
    
    Release inode_bitmap_bh from ext4_read_inode_bitmap() in
    ext4_mark_inode_used() to avoid buffer_head leak.
    By the way, remove unneeded goto for invalid ino when inode_bitmap_bh
    is NULL.
    
    Fixes: 8016e29f4362 ("ext4: fast commit recovery path")
    Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20240820132234.2759926-2-shikemeng@xxxxxxxxxxxxxxx
    Signed-off-by: Theodore Ts'o <tytso@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
index e9bbb1da2d0a2..bf14450da35f4 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -755,10 +755,10 @@ int ext4_mark_inode_used(struct super_block *sb, int ino)
 	struct ext4_group_desc *gdp;
 	ext4_group_t group;
 	int bit;
-	int err = -EFSCORRUPTED;
+	int err;
 
 	if (ino < EXT4_FIRST_INO(sb) || ino > max_ino)
-		goto out;
+		return -EFSCORRUPTED;
 
 	group = (ino - 1) / EXT4_INODES_PER_GROUP(sb);
 	bit = (ino - 1) % EXT4_INODES_PER_GROUP(sb);
@@ -860,6 +860,7 @@ int ext4_mark_inode_used(struct super_block *sb, int ino)
 	err = ext4_handle_dirty_metadata(NULL, NULL, group_desc_bh);
 	sync_dirty_buffer(group_desc_bh);
 out:
+	brelse(inode_bitmap_bh);
 	return err;
 }
 




[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