Patch "erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF" has been added to the 6.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

    erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF

to the 6.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:
     erofs-avoid-useless-loops-in-z_erofs_pcluster_readmo.patch
and it can be found in the queue-6.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 201f9e4e49bcb83a199bb05c153545ff504140bf
Author: Chunhai Guo <guochunhai@xxxxxxxx>
Date:   Mon Jul 10 12:25:31 2023 +0800

    erofs: avoid useless loops in z_erofs_pcluster_readmore() when reading beyond EOF
    
    [ Upstream commit 936aa701d82d397c2d1afcd18ce2c739471d978d ]
    
    z_erofs_pcluster_readmore() may take a long time to loop when the page
    offset is large enough, which is unnecessary should be prevented.
    
    For example, when the following case is encountered, it will loop 4691368
    times, taking about 27 seconds:
        - offset = 19217289215
        - inode_size = 1442672
    
    Signed-off-by: Chunhai Guo <guochunhai@xxxxxxxx>
    Fixes: 386292919c25 ("erofs: introduce readmore decompression strategy")
    Reviewed-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
    Reviewed-by: Yue Hu <huyue2@xxxxxxxxxxx>
    Reviewed-by: Chao Yu <chao@xxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230710042531.28761-1-guochunhai@xxxxxxxx
    Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/erofs/zdata.c b/fs/erofs/zdata.c
index 502893e3da010..bedfff5d45faf 100644
--- a/fs/erofs/zdata.c
+++ b/fs/erofs/zdata.c
@@ -1807,7 +1807,7 @@ static void z_erofs_pcluster_readmore(struct z_erofs_decompress_frontend *f,
 	}
 
 	cur = map->m_la + map->m_llen - 1;
-	while (cur >= end) {
+	while ((cur >= end) && (cur < i_size_read(inode))) {
 		pgoff_t index = cur >> PAGE_SHIFT;
 		struct page *page;
 



[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