diff options
author | Myungho Jung <mhjungk@gmail.com> | 2018-11-21 15:18:30 -0800 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2018-11-22 10:20:19 +0100 |
commit | 4fc4bb796b0c75067fd65292dfd874869ff7c9dc (patch) | |
tree | e90c93726d87faef5ff42d5e3c165a8f593cbb72 /fs/fuse | |
parent | 9ff01193a20d391e8dbce4403dd5ef87c7eaaca6 (diff) | |
download | lwn-4fc4bb796b0c75067fd65292dfd874869ff7c9dc.tar.gz lwn-4fc4bb796b0c75067fd65292dfd874869ff7c9dc.zip |
fuse: Add bad inode check in fuse_destroy_inode()
make_bad_inode() sets inode->i_mode to S_IFREG if I/O error is detected
in fuse_do_getattr()/fuse_do_setattr(). If the inode is not a regular
file, write_files and queued_writes in fuse_inode are not initialized
and have NULL or invalid pointers written by other members in a union.
So, list_empty() returns false in fuse_destroy_inode(). Add
is_bad_inode() to check if make_bad_inode() was called.
Reported-by: syzbot+b9c89b84423073226299@syzkaller.appspotmail.com
Fixes: ab2257e9941b ("fuse: reduce size of struct fuse_inode")
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/inode.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/fuse/inode.c b/fs/fuse/inode.c index 0b94b23b02d4..073865371f9b 100644 --- a/fs/fuse/inode.c +++ b/fs/fuse/inode.c @@ -115,7 +115,7 @@ static void fuse_i_callback(struct rcu_head *head) static void fuse_destroy_inode(struct inode *inode) { struct fuse_inode *fi = get_fuse_inode(inode); - if (S_ISREG(inode->i_mode)) { + if (S_ISREG(inode->i_mode) && !is_bad_inode(inode)) { WARN_ON(!list_empty(&fi->write_files)); WARN_ON(!list_empty(&fi->queued_writes)); } |