[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <tencent_F0CF4B761BAA2549BAA0BB1E33D09E561B08@qq.com>
Date: Sat, 23 Aug 2025 09:17:13 +0800
From: Edward Adam Davis <eadavis@...com>
To: syzbot+2d215d165f9354b9c4ea@...kaller.appspotmail.com
Cc: linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
miklos@...redi.hu,
syzkaller-bugs@...glegroups.com
Subject: [PATCH] fuse: Block access to folio overlimit
syz reported a slab-out-of-bounds Write in fuse_dev_do_write.
Using the number of bytes alone as the termination condition in a loop
can prematurely exhaust the allocated memory if the incremented byte count
is less than PAGE_SIZE.
Add a loop termination condition to prevent overruns.
Fixes: 3568a9569326 ("fuse: support large folios for retrieves")
Reported-by: syzbot+2d215d165f9354b9c4ea@...kaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2d215d165f9354b9c4ea
Tested-by: syzbot+2d215d165f9354b9c4ea@...kaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@...com>
---
fs/fuse/dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c
index e80cd8f2c049..5150aa25e64b 100644
--- a/fs/fuse/dev.c
+++ b/fs/fuse/dev.c
@@ -1893,7 +1893,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
index = outarg->offset >> PAGE_SHIFT;
- while (num) {
+ while (num && ap->num_folios < num_pages) {
struct folio *folio;
unsigned int folio_offset;
unsigned int nr_bytes;
--
2.43.0
Powered by blists - more mailing lists