* [PATCH] fuse: Add bad inode check in fuse_destroy_inode()
@ 2018-11-21 23:18 Myungho Jung
2018-11-22 9:20 ` Miklos Szeredi
0 siblings, 1 reply; 2+ messages in thread
From: Myungho Jung @ 2018-11-21 23:18 UTC (permalink / raw)
To: Miklos Szeredi; +Cc: linux-fsdevel, linux-kernel
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
Signed-off-by: Myungho Jung <mhjungk@gmail.com>
---
fs/fuse/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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));
}
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fuse: Add bad inode check in fuse_destroy_inode()
2018-11-21 23:18 [PATCH] fuse: Add bad inode check in fuse_destroy_inode() Myungho Jung
@ 2018-11-22 9:20 ` Miklos Szeredi
0 siblings, 0 replies; 2+ messages in thread
From: Miklos Szeredi @ 2018-11-22 9:20 UTC (permalink / raw)
To: mhjungk; +Cc: linux-fsdevel, linux-kernel
On Thu, Nov 22, 2018 at 12:18 AM Myungho Jung <mhjungk@gmail.com> wrote:
>
> 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
> Signed-off-by: Myungho Jung <mhjungk@gmail.com>
Thanks, applied.
Miklos
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-22 9:21 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-21 23:18 [PATCH] fuse: Add bad inode check in fuse_destroy_inode() Myungho Jung
2018-11-22 9:20 ` Miklos Szeredi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).