Skip to content

Commit d5d188b

Browse files
committed
erofs: fix missing unmap if z_erofs_get_extent_compressedlen() fails
Otherwise, meta buffers could be leaked. Fixes: cec6e93 ("erofs: support parsing big pcluster compress indexes") Reviewed-by: Yue Hu <[email protected]> Reviewed-by: Chao Yu <[email protected]> Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c42c0ff commit d5d188b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

fs/erofs/zmap.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ static int z_erofs_do_map_blocks(struct inode *inode,
694694
map->m_pa = blknr_to_addr(m.pblk);
695695
err = z_erofs_get_extent_compressedlen(&m, initial_lcn);
696696
if (err)
697-
goto out;
697+
goto unmap_out;
698698
}
699699

700700
if (m.headtype == Z_EROFS_VLE_CLUSTER_TYPE_PLAIN) {
@@ -718,14 +718,12 @@ static int z_erofs_do_map_blocks(struct inode *inode,
718718
if (!err)
719719
map->m_flags |= EROFS_MAP_FULL_MAPPED;
720720
}
721+
721722
unmap_out:
722723
erofs_unmap_metabuf(&m.map->buf);
723-
724-
out:
725724
erofs_dbg("%s, m_la %llu m_pa %llu m_llen %llu m_plen %llu m_flags 0%o",
726725
__func__, map->m_la, map->m_pa,
727726
map->m_llen, map->m_plen, map->m_flags);
728-
729727
return err;
730728
}
731729

0 commit comments

Comments
 (0)