Patch "ext4: avoid negative min_clusters in find_group_orlov()" has been added to the 6.1-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 negative min_clusters in find_group_orlov()

to the 6.1-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-negative-min_clusters-in-find_group_orlov.patch
and it can be found in the queue-6.1 subdirectory.

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



commit 4ac2313d98954997eb467a6f946c02289aca3ad0
Author: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
Date:   Tue Aug 20 21:22:30 2024 +0800

    ext4: avoid negative min_clusters in find_group_orlov()
    
    [ Upstream commit bb0a12c3439b10d88412fd3102df5b9a6e3cd6dc ]
    
    min_clusters is signed integer and will be converted to unsigned
    integer when compared with unsigned number stats.free_clusters.
    If min_clusters is negative, it will be converted to a huge unsigned
    value in which case all groups may not meet the actual desired free
    clusters.
    Set negative min_clusters to 0 to avoid unexpected behavior.
    
    Fixes: ac27a0ec112a ("[PATCH] ext4: initial copy of files from ext3")
    Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
    Link: https://patch.msgid.link/20240820132234.2759926-4-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 99e8852c4e1dd..8a8d802275608 100644
--- a/fs/ext4/ialloc.c
+++ b/fs/ext4/ialloc.c
@@ -514,6 +514,8 @@ static int find_group_orlov(struct super_block *sb, struct inode *parent,
 	if (min_inodes < 1)
 		min_inodes = 1;
 	min_clusters = avefreec - EXT4_CLUSTERS_PER_GROUP(sb)*flex_size / 4;
+	if (min_clusters < 0)
+		min_clusters = 0;
 
 	/*
 	 * Start looking in the flex group where we last allocated an




[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