sst-linux/fs/erofs
Gao Xiang 75a0a6dde8 erofs: handle NONHEAD !delta[1] lclusters gracefully
commit 0bc8061ffc733a0a246b8689b2d32a3e9204f43c upstream.

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: syzbot+6c0b301317aa0156f9eb@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/67373c0c.050a0220.2a2fcc.0079.GAE@google.com
Tested-by: syzbot+6c0b301317aa0156f9eb@syzkaller.appspotmail.com
Fixes: d95ae5e253 ("erofs: add support for the full decompressed length")
Fixes: 001b8ccd0650 ("erofs: fix compact 4B support for 16k block size")
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241115173651.3339514-1-hsiangkao@linux.alibaba.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-01-23 17:17:17 +01:00
..
compress.h erofs: simplify compression configuration parser 2024-03-01 13:26:38 +01:00
data.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
decompressor_lzma.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
decompressor.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
dir.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
erofs_fs.h erofs: tidy up EROFS on-disk naming 2025-01-23 17:17:17 +01:00
fscache.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
inode.c erofs: fix incorrect symlink detection in fast symlink 2024-10-17 15:22:09 +02:00
internal.h erofs: set block size to the on-disk block size 2024-10-17 15:22:09 +02:00
Kconfig
Makefile
namei.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
pcpubuf.c
super.c erofs: set block size to the on-disk block size 2024-10-17 15:22:09 +02:00
sysfs.c
utils.c
xattr.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
xattr.h erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
zdata.c erofs: avoid hardcoded blocksize for subpage block support 2024-10-17 15:22:08 +02:00
zmap.c erofs: handle NONHEAD !delta[1] lclusters gracefully 2025-01-23 17:17:17 +01:00