Patch "erofs: ensure m_llen is reset to 0 if metadata is invalid" has been added to the 6.6-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: ensure m_llen is reset to 0 if metadata is invalid

to the 6.6-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-ensure-m_llen-is-reset-to-0-if-metadata-is-inv.patch
and it can be found in the queue-6.6 subdirectory.

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



commit 6bbdf850b1dfad27ff9a8871cb6a79c70d2e2bf0
Author: Gao Xiang <xiang@xxxxxxxxxx>
Date:   Sun Jun 30 02:57:43 2024 +0800

    erofs: ensure m_llen is reset to 0 if metadata is invalid
    
    [ Upstream commit 9b32b063be1001e322c5f6e01f2a649636947851 ]
    
    Sometimes, the on-disk metadata might be invalid due to user
    interrupts, storage failures, or other unknown causes.
    
    In that case, z_erofs_map_blocks_iter() may still return a valid
    m_llen while other fields remain invalid (e.g., m_plen can be 0).
    
    Due to the return value of z_erofs_scan_folio() in some path will
    be ignored on purpose, the following z_erofs_scan_folio() could
    then use the invalid value by accident.
    
    Let's reset m_llen to 0 to prevent this.
    
    Link: https://lore.kernel.org/r/20240629185743.2819229-1-hsiangkao@xxxxxxxxxxxxxxxxx
    Signed-off-by: Gao Xiang <hsiangkao@xxxxxxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index e313c936351d5..6bd435a565f61 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -723,6 +723,8 @@ int z_erofs_map_blocks_iter(struct inode *inode, struct erofs_map_blocks *map,
 
 	err = z_erofs_do_map_blocks(inode, map, flags);
 out:
+	if (err)
+		map->m_llen = 0;
 	trace_z_erofs_map_blocks_iter_exit(inode, map, flags, err);
 	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