[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231116031352.40853-1-lizhi.xu@windriver.com>
Date: Thu, 16 Nov 2023 11:13:52 +0800
From: Lizhi Xu <lizhi.xu@...driver.com>
To: <syzbot+32d3767580a1ea339a81@...kaller.appspotmail.com>
CC: <linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<phillip@...ashfs.org.uk>, <squashfs-devel@...ts.sourceforge.net>,
<syzkaller-bugs@...glegroups.com>
Subject: [PATCH] squashfs: squashfs_read_data need to check if the length is 0
when the length passed in is 0, the subsequent process should be exited.
Reported-by: syzbot+32d3767580a1ea339a81@...kaller.appspotmail.com
Signed-off-by: Lizhi Xu <lizhi.xu@...driver.com>
---
fs/squashfs/block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/squashfs/block.c b/fs/squashfs/block.c
index 581ce9519339..2dc730800f44 100644
--- a/fs/squashfs/block.c
+++ b/fs/squashfs/block.c
@@ -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;
--
2.25.1
Powered by blists - more mailing lists