In case of reading fragment data, map->m_plen is invalid.
Fixes: c505feba4c0d ("erofs: validate the extent length for uncompressed
pclusters")
Signed-off-by: Noboru Asai <[email protected]>
---
fs/erofs/zmap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index 8bf6d30518b6..902b166a5a5e 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -572,7 +572,7 @@ static int z_erofs_do_map_blocks(struct inode *inode,
}
if (m.headtype == Z_EROFS_VLE_CLUSTER_TYPE_PLAIN) {
- if (map->m_llen > map->m_plen) {
+ if (!(map->m_flags & EROFS_MAP_FRAGMENT) && (map->m_llen >
map->m_plen) {
DBG_BUGON(1);
err = -EFSCORRUPTED;
goto unmap_out;
--
2.39.2