]> git.hungrycats.org Git - linux/commit
erofs: ensure m_llen is reset to 0 if metadata is invalid
authorGao Xiang <hsiangkao@linux.alibaba.com>
Sat, 29 Jun 2024 18:57:43 +0000 (02:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Jul 2024 07:53:37 +0000 (09:53 +0200)
commit29e9518ea58ff1f3b881c5baf31be5c616509c4b
tree6fcaefdd4ee970cbd78b2c74cda9669b4ca9e49f
parent3b732449b78183d17178db40be3a4401cf3cd629
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@linux.alibaba.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/erofs/zmap.c