[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YSXSyGliOy9BCLkj@zeniv-ca.linux.org.uk>
Date: Wed, 25 Aug 2021 05:19:04 +0000
From: Al Viro <viro@...iv.linux.org.uk>
To: Christoph Hellwig <hch@....de>
Cc: "Gong, Sishuai" <sishuai@...due.edu>,
"jlbec@...lplan.org" <jlbec@...lplan.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] configfs: fix a race in configfs_lookup()
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.
> + 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?
Powered by blists - more mailing lists