]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
erofs: error out obviously illegal extents in advance
authorGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 10 Apr 2026 08:48:38 +0000 (16:48 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Fri, 10 Apr 2026 08:53:39 +0000 (16:53 +0800)
commita5242d37c83abe86df95c6941e2ace9f9055ffcb
treecadf6f4f5b81939b9cb8e679717f44c04a22b190
parent5c40d2e9e3ce9e81d76773c68756e9b07cce802c
erofs: error out obviously illegal extents in advance

Detect some corrupted extent cases during metadata parsing rather
than letting them result in harmless decompression failures later:

 - For full-reference compressed extents, the compressed size must
   not exceed the decompressed size, which is a strict on-disk
   layout constraint;

 - For plain (shifted/interlaced) extents, the decoded size must
   not exceed the encoded size, even accounting for partial decoding.

Both ways work but it should be better to report illegal extents as
metadata layout violations rather than deferring as decompression
failure.

Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
fs/erofs/decompressor.c
fs/erofs/zmap.c