Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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: 3568a9569326 ("fuse: support large folios for retrieves")
Reported-by: syzbot+2d215d165f9354b9c4ea@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=2d215d165f9354b9c4ea
Tested-by: syzbot+2d215d165f9354b9c4ea@syzkaller.appspotmail.com
Signed-off-by: Edward Adam Davis <eadavis@qq.com>
Reviewed-by: Joanne Koong <joannelkoong@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>

authored by

Edward Adam Davis and committed by
Miklos Szeredi
9d81ba6d bd24d210

+1 -1
+1 -1
fs/fuse/dev.c
··· 1893 1893 1894 1894 index = outarg->offset >> PAGE_SHIFT; 1895 1895 1896 - while (num) { 1896 + while (num && ap->num_folios < num_pages) { 1897 1897 struct folio *folio; 1898 1898 unsigned int folio_offset; 1899 1899 unsigned int nr_bytes;