fuse: fix bad inode
commit 5d069dbe upstream. Jan Kara's analysis of the syzbot report (edited): The reproducer opens a directory on FUSE filesystem, it then attaches dnotify mark to the open directory. After that a fuse_do_getattr() call finds that attributes returned by the server are inconsistent, and calls make_bad_inode() which, among other things does: inode->i_mode = S_IFREG; This then confuses dnotify which doesn't tear down its structures properly and eventually crashes. Avoid calling make_bad_inode() on a live inode: switch to a private flag on the fuse inode. Also add the test to ops which the bad_inode_ops would have caught. This bug goes back to the initial merge of fuse in 2.6.14... Reported-by:<syzbot+f427adf9324b92652ccc@syzkaller.appspotmail.com> Signed-off-by:
Miklos Szeredi <mszeredi@redhat.com> Tested-by:
Jan Kara <jack@suse.cz> Cc: <stable@vger.kernel.org> [bwh: Backported to 4.19: - Drop changes in fuse_dir_fsync(), fuse_readahead(), fuse_evict_inode() - In fuse_get_link(), return ERR_PTR(-EIO) for bad inodes - Convert some additional calls to is_bad_inode() - Adjust filename, context] Signed-off-by:
Ben Hutchings <ben@decadent.org.uk> Signed-off-by:
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Showing
- fs/fuse/acl.c 6 additions, 0 deletionsfs/fuse/acl.c
- fs/fuse/dir.c 35 additions, 5 deletionsfs/fuse/dir.c
- fs/fuse/file.c 18 additions, 9 deletionsfs/fuse/file.c
- fs/fuse/fuse_i.h 12 additions, 0 deletionsfs/fuse/fuse_i.h
- fs/fuse/inode.c 1 addition, 1 deletionfs/fuse/inode.c
- fs/fuse/xattr.c 9 additions, 0 deletionsfs/fuse/xattr.c
Loading
Please register or sign in to comment