All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Cc: miklos@szeredi.hu,
	syzbot <syzbot+32c236387d66c4516827@syzkaller.appspotmail.com>,
	syzkaller-bugs@googlegroups.com, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] fuse: don't keep inode-less dentry at fuse_ctl_add_dentry().
Date: Thu, 10 May 2018 21:07:53 +0100	[thread overview]
Message-ID: <20180510200753.GU30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <b1f0e06c-1f66-2f31-fdad-95c2e50eeddf@I-love.SAKURA.ne.jp>

On Wed, May 09, 2018 at 07:58:58PM +0900, Tetsuo Handa wrote:
> >From 9f41081f8bd6762a6f629e5e23e6d07a62bba69c Mon Sep 17 00:00:00 2001
> From: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> Date: Sat, 28 Apr 2018 11:24:09 +0900
> Subject: [PATCH] fuse: don't keep inode-less dentry at fuse_ctl_add_dentry().
> 
> syzbot is reporting NULL pointer dereference at fuse_ctl_remove_conn() [1].
> Since fc->ctl_ndents is incremented by fuse_ctl_add_conn() when new_inode()
> failed, fuse_ctl_remove_conn() reaches an inode-less dentry and tries to
> clear d_inode(dentry)->i_private field. Fix this by calling dput() rather
> than incrementing fc->ctl_ndents when new_inode() failed.

That looks bloody awful.  Sure, everything that accesses fc->ctl_dentry is
synchronous with this, but it would've been much easier to follow if
shoving dentry into that array happened only after it's been fully set
up.

Incidentally, there's a nasty headache waiting to happen in that code -
consider a twit mounting something on that.  And think what happens when
connection gets shut down...

  reply	other threads:[~2018-05-10 20:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-27 16:00 general protection fault in fuse_ctl_remove_conn syzbot
2018-04-28  2:29 ` Tetsuo Handa
2018-05-09 10:58   ` [PATCH] fuse: don't keep inode-less dentry at fuse_ctl_add_dentry() Tetsuo Handa
2018-05-10 20:07     ` Al Viro [this message]
2018-05-11  7:55       ` Miklos Szeredi
2018-05-11 10:30         ` Tetsuo Handa
2018-05-11 22:12         ` Al Viro
2018-05-31 14:27   ` general protection fault in fuse_ctl_remove_conn Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180510200753.GU30522@ZenIV.linux.org.uk \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=penguin-kernel@I-love.SAKURA.ne.jp \
    --cc=syzbot+32c236387d66c4516827@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.