Commit eb66b8ab authored by Lizhi Xu's avatar Lizhi Xu Committed by Andrew Morton
Browse files

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: default avatar <syzbot+32d3767580a1ea339a81@syzkaller.appspotmail.com>
Closes: https://lkml.kernel.org/r/0000000000000526f2060a30a085@google.com


Signed-off-by: default avatarLizhi Xu <lizhi.xu@windriver.com>
Reviewed-by: default avatarPhillip Lougher <phillip@squashfs.org.uk>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 3f3cac5c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -321,7 +321,7 @@ int squashfs_read_data(struct super_block *sb, u64 index, int length,
		TRACE("Block @ 0x%llx, %scompressed size %d\n", index - 2,
		      compressed ? "" : "un", length);
	}
	if (length < 0 || length > output->length ||
	if (length <= 0 || length > output->length ||
			(index + length) > msblk->bytes_used) {
		res = -EIO;
		goto out;