Commit 0bc8061f authored by Gao Xiang's avatar Gao Xiang
Browse files

erofs: handle NONHEAD !delta[1] lclusters gracefully



syzbot reported a WARNING in iomap_iter_done:
 iomap_fiemap+0x73b/0x9b0 fs/iomap/fiemap.c:80
 ioctl_fiemap fs/ioctl.c:220 [inline]

Generally, NONHEAD lclusters won't have delta[1]==0, except for crafted
images and filesystems created by pre-1.0 mkfs versions.

Previously, it would immediately bail out if delta[1]==0, which led to
inadequate decompressed lengths (thus FIEMAP is impacted).  Treat it as
delta[1]=1 to work around these legacy mkfs versions.

`lclusterbits > 14` is illegal for compact indexes, error out too.

Reported-by: default avatar <syzbot+6c0b301317aa0156f9eb@syzkaller.appspotmail.com>
Closes: https://lore.kernel.org/r/67373c0c.050a0220.2a2fcc.0079.GAE@google.com


Tested-by: default avatar <syzbot+6c0b301317aa0156f9eb@syzkaller.appspotmail.com>
Fixes: d95ae5e2 ("erofs: add support for the full decompressed length")
Fixes: 001b8ccd ("erofs: fix compact 4B support for 16k block size")
Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241115173651.3339514-1-hsiangkao@linux.alibaba.com
parent b49c0215
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment