public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@lst.de>,
	"Gong, Sishuai" <sishuai@purdue.edu>,
	"jlbec@evilplan.org" <jlbec@evilplan.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] configfs: fix a race in configfs_lookup()
Date: Wed, 25 Aug 2021 07:29:00 +0200	[thread overview]
Message-ID: <20210825052900.GA26714@lst.de> (raw)
In-Reply-To: <YSXSyGliOy9BCLkj@zeniv-ca.linux.org.uk>

On Wed, Aug 25, 2021 at 05:19:04AM +0000, Al Viro wrote:
> On Mon, Aug 23, 2021 at 07:08:47PM +0200, Christoph Hellwig wrote:
> 
> > We can't hold a spinlock over inode allocation.  So it would have to be
> > something like this:
> 
> Check for -ENAMETOOLONG first; easier for analysis that way.

Indeed.

> > +			dentry->d_fsdata = configfs_get(sd);
> > +			sd->s_dentry = dentry;
> > +			spin_unlock(&configfs_dirent_lock);
> >  
> > -			found = 1;
> > -			err = configfs_attach_attr(sd, dentry);
> > -			break;
> > +			inode = configfs_create(dentry, mode);
> > +			if (IS_ERR(inode)) {
> > +				configfs_put(sd);
> > +				return ERR_CAST(inode);
> 
> Er...  Won't that leave dentry with dangling ->d_fsdata?

Yes.  Existing problem, though.

  reply	other threads:[~2021-08-25  5:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 21:44 [PATCH] configfs: fix a race in configfs_lookup() sishuaigong
2021-08-23  7:46 ` Christoph Hellwig
     [not found]   ` <AFABA8B1-0523-4F8C-A9DD-DDC5638DEAF7@purdue.edu>
2021-08-23 17:08     ` Christoph Hellwig
2021-08-23 19:07       ` Gong, Sishuai
2021-08-25  5:19       ` Al Viro
2021-08-25  5:29         ` Christoph Hellwig [this message]
     [not found] <20210820213243.786-1-sishuai@purdue.edu>
2021-12-29  2:23 ` Gong, Sishuai

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=20210825052900.GA26714@lst.de \
    --to=hch@lst.de \
    --cc=jlbec@evilplan.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sishuai@purdue.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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