Skip to content

Commit eb66b8a

Browse files
Lizhi Xuakpm00
authored andcommitted
squashfs: squashfs_read_data need to check if the length is 0
When the length passed in is 0, the pagemap_scan_test_walk() caller should bail. This error causes at least a WARN_ON(). Link: https://lkml.kernel.org/r/20231116031352.40853-1-lizhi.xu@windriver.com Reported-by: syzbot+32d3767580a1ea339a81@syzkaller.appspotmail.com Closes: https://lkml.kernel.org/r/0000000000000526f2060a30a085@google.com Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com> Reviewed-by: Phillip Lougher <phillip@squashfs.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 3f3cac5 commit eb66b8a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

fs/squashfs/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
321321
TRACE("Block @ 0x%llx, %scompressed size %d\n", index - 2,
322322
compressed ? "" : "un", length);
323323
}
324-
if (length < 0 || length > output->length ||
324+
if (length <= 0 || length > output->length ||
325325
(index + length) > msblk->bytes_used) {
326326
res = -EIO;
327327
goto out;

0 commit comments

Comments
 (0)