linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	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: Fri, 11 May 2018 23:12:16 +0100	[thread overview]
Message-ID: <20180511221216.GI30522@ZenIV.linux.org.uk> (raw)
In-Reply-To: <CAJfpegt+v6oB3Qw-RvgaQ2GgpFaFqT2OHuAOE_kzBrTgVrbymQ@mail.gmail.com>

On Fri, May 11, 2018 at 09:55:00AM +0200, Miklos Szeredi wrote:
> On Thu, May 10, 2018 at 10:07 PM, Al Viro <viro@zeniv.linux.org.uk> wrote:
> > 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...
> 
> Need to call d_invalidate() instead of d_drop() in there.  Is that
> what you are referring to?

Yes, and do that once on the entire subdirectory...

  parent reply	other threads:[~2018-05-11 22:12 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
2018-05-11  7:55       ` Miklos Szeredi
2018-05-11 10:30         ` Tetsuo Handa
2018-05-11 22:12         ` Al Viro [this message]
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=20180511221216.GI30522@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 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).