Skip to content

Commit 9d81ba6

Browse files
ea1davisMiklos Szeredi
authored andcommitted
fuse: Block access to folio overlimit
syz reported a slab-out-of-bounds Write in fuse_dev_do_write. When the number of bytes to be retrieved is truncated to the upper limit by fc->max_pages and there is an offset, the oob is triggered. Add a loop termination condition to prevent overruns. Fixes: 3568a95 ("fuse: support large folios for retrieves") Reported-by: [email protected] Closes: https://syzkaller.appspot.com/bug?extid=2d215d165f9354b9c4ea Tested-by: [email protected] Signed-off-by: Edward Adam Davis <[email protected]> Reviewed-by: Joanne Koong <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]>
1 parent bd24d21 commit 9d81ba6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/fuse/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1893,7 +1893,7 @@ static int fuse_retrieve(struct fuse_mount *fm, struct inode *inode,
18931893

18941894
index = outarg->offset >> PAGE_SHIFT;
18951895

1896-
while (num) {
1896+
while (num && ap->num_folios < num_pages) {
18971897
struct folio *folio;
18981898
unsigned int folio_offset;
18991899
unsigned int nr_bytes;

0 commit comments

Comments
 (0)