Skip to content

Commit 7869738

Browse files
committed
erofs: refuse crafted out-of-file-range encoded extents
Crafted encoded extents could record out-of-range `lstart`, which should not happen in normal cases. It caused an iomap_iter_done() complaint [1] reported by syzbot. [1] https://lore.kernel.org/r/[email protected] Fixes: 1d191b4 ("erofs: implement encoded extent metadata") Reported-and-tested-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=d8f000c609f05f52d9b5 Signed-off-by: Gao Xiang <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 30b5844 commit 7869738

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

fs/erofs/zmap.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -597,6 +597,10 @@ static int z_erofs_map_blocks_ext(struct inode *inode,
597597

598598
if (la > map->m_la) {
599599
r = mid;
600+
if (la > lend) {
601+
DBG_BUGON(1);
602+
return -EFSCORRUPTED;
603+
}
600604
lend = la;
601605
} else {
602606
l = mid + 1;

0 commit comments

Comments
 (0)