erofs-utils: lib: return -EFSCORRUPTED for oversized tail pclusters
PATCH 1/1 erofs-utils: lib: return -EFSCORRUPTED for oversized tail pclusters
From: Zhan Xusheng <[email protected]>
z_erofs_map_blocks_fo() prints "invalid tail-packing pclustersize" when a tail-packed pcluster crosses a block boundary, but err is still 0 there, so the mapping succeeds. With h_idata_size of a file in an -Eztailpacking image set to 4080, fsck.erofs prints the message and exits with 0.
Return -EFSCORRUPTED, as the check did before it was moved here.
Fixes 97ad172b79b7 ("erofs-utils: lib: clean up header parsing for ztailpacking and fragments")
Signed-off-by Zhan Xusheng <[email protected]>
--- lib/zmap.c | 1 + 1 file changed, 1 insertion(+)
lib/zmap.c +1 -0
@@ -501,6 +501,7 @@ static int z_erofs_map_blocks_fo(struct erofs_inode *vi,if (erofs_blkoff (sbi, map->m_pa) + map->m_plen >erofs_blksiz (sbi)) {erofs_err ("invalid tail-packing pclustersize %llu" , map->m_plen |0ULL ); + err = -EFSCORRUPTED ; goto out; } }else if (fragment && m.lcn == vi->z_tailextent_headlcn) {
base-commit: 8a8d4892b6b09919053ba3561d289af76095c625
Signature · 1 line
2.43.0