]> www.infradead.org Git - users/hch/misc.git/commit
erofs: fix file-backed mounts over FUSE
authorGao Xiang <hsiangkao@linux.alibaba.com>
Thu, 14 Nov 2024 23:49:05 +0000 (07:49 +0800)
committerGao Xiang <hsiangkao@linux.alibaba.com>
Mon, 18 Nov 2024 10:50:13 +0000 (18:50 +0800)
commit3a23787ca8756920d65fda39f41353a4be1d1642
tree73dcc6a9123bcfcf889ecdaefb58d96ed57a4e26
parent90655ee279b299c33dc51be87787b54222d3d2fb
erofs: fix file-backed mounts over FUSE

syzbot reported a null-ptr-deref in fuse_read_args_fill:
 fuse_read_folio+0xb0/0x100 fs/fuse/file.c:905
 filemap_read_folio+0xc6/0x2a0 mm/filemap.c:2367
 do_read_cache_folio+0x263/0x5c0 mm/filemap.c:3825
 read_mapping_folio include/linux/pagemap.h:1011 [inline]
 erofs_bread+0x34d/0x7e0 fs/erofs/data.c:41
 erofs_read_superblock fs/erofs/super.c:281 [inline]
 erofs_fc_fill_super+0x2b9/0x2500 fs/erofs/super.c:625

Unlike most filesystems, some network filesystems and FUSE need
unavoidable valid `file` pointers for their read I/Os [1].
Anyway, those use cases need to be supported too.

[1] https://docs.kernel.org/filesystems/vfs.html

Reported-by: syzbot+0b1279812c46e48bb0c1@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/r/6727bbdf.050a0220.3c8d68.0a7e.GAE@google.com
Fixes: fb176750266a ("erofs: add file-backed mount support")
Tested-by: syzbot+0b1279812c46e48bb0c1@syzkaller.appspotmail.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20241114234905.1873723-1-hsiangkao@linux.alibaba.com
fs/erofs/data.c
fs/erofs/internal.h