[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <000000000000bb74b9060a14717c@google.com>
Date: Mon, 13 Nov 2023 19:33:03 -0800
From: syzbot <syzbot+604424eb051c2f696163@...kaller.appspotmail.com>
To: linux-kernel@...r.kernel.org
Subject: Re: [syzbot] [PATCH] Test oob in squashfs readahead
For archival purposes, forwarding an incoming command email to
linux-kernel@...r.kernel.org.
***
Subject: [PATCH] Test oob in squashfs readahead
Author: eadavis@...com
please test squashfs readahead oob
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 13d88ac54ddd
diff --git a/fs/squashfs/file.c b/fs/squashfs/file.c
index 8ba8c4c50770..b54d6b993357 100644
--- a/fs/squashfs/file.c
+++ b/fs/squashfs/file.c
@@ -461,6 +461,12 @@ static int squashfs_read_folio(struct file *file, struct folio *folio)
TRACE("Entered squashfs_readpage, page index %lx, start block %llx\n",
page->index, squashfs_i(inode)->start);
+ if (!file_end) {
+ printk("i:%p, is:%d, %s\n", inode, i_size_read(inode), __func__);
+ res = -EINVAL;
+ goto out;
+ }
+
if (page->index >= ((i_size_read(inode) + PAGE_SIZE - 1) >>
PAGE_SHIFT))
goto out;
@@ -547,6 +553,11 @@ static void squashfs_readahead(struct readahead_control *ractl)
int i, file_end = i_size_read(inode) >> msblk->block_log;
unsigned int max_pages = 1UL << shift;
+ if (!file_end && !start) {
+ printk("i:%p, is:%d, %s\n", inode, i_size_read(inode), __func__);
+ return;
+ }
+
readahead_expand(ractl, start, (len | mask) + 1);
pages = kmalloc_array(max_pages, sizeof(void *), GFP_KERNEL);
diff --git a/fs/squashfs/inode.c b/fs/squashfs/inode.c
index aa3411354e66..680d8b302e60 100644
--- a/fs/squashfs/inode.c
+++ b/fs/squashfs/inode.c
@@ -125,6 +125,7 @@ int squashfs_read_inode(struct inode *inode, long long ino)
offset = SQUASHFS_INODE_OFFSET(ino);
type = le16_to_cpu(sqshb_ino->inode_type);
+ printk("in: %p, fs: %d, it: %d, %s\n", inode, le32_to_cpu(sqsh_ino->file_size), type, __func__);
switch (type) {
case SQUASHFS_REG_TYPE: {
unsigned int frag_offset, frag;
Powered by blists - more mailing lists