Commit 2414c5e0 authored by zhoumaowei's avatar zhoumaowei Committed by Sandeep Dhavale
Browse files

UPSTREAM: erofs: ensure m_llen is reset to 0 if metadata is invalid

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: default avatarGao Xiang <hsiangkao@linux.alibaba.com>

(cherry picked from commit 9b32b063
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/

 master)

Bug: 349541961
Change-Id: Iaa27697bb69cf1262af64c680f625baa72baf821
Signed-off-by: default avatarzhoumaowei <zhoumaowei@oppo.com>
parent 2a09862b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment