From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Biggers Subject: Re: [PATCH 1/5] fscrypt: clean up and improve dentry revalidation Date: Mon, 18 Mar 2019 13:29:49 -0700 Message-ID: <20190318202948.GD194307@gmail.com> References: <20190317200444.5967-1-ebiggers@kernel.org> <20190317200444.5967-2-ebiggers@kernel.org> <20190317203822.GH2217@ZenIV.linux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1h5ytT-0006Iz-5h for linux-f2fs-devel@lists.sourceforge.net; Mon, 18 Mar 2019 20:29:59 +0000 Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-3.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1h5ytR-00BoEg-Kn for linux-f2fs-devel@lists.sourceforge.net; Mon, 18 Mar 2019 20:29:59 +0000 Content-Disposition: inline In-Reply-To: <20190317203822.GH2217@ZenIV.linux.org.uk> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Al Viro Cc: linux-unionfs@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-fscrypt@vger.kernel.org, linux-mtd@lists.infradead.org, Sarthak Kukreti , linux-fsdevel@vger.kernel.org, linux-ext4@vger.kernel.org On Sun, Mar 17, 2019 at 08:38:22PM +0000, Al Viro wrote: > On Sun, Mar 17, 2019 at 01:04:40PM -0700, Eric Biggers wrote: > > + /* > > + * Ciphertext name; valid if the directory's key is still unavailable. > > + * > > + * Note: since fscrypt forbids rename() on ciphertext names, it should > > + * be safe to access ->d_parent directly here. > > No, it is not. Again, d_splice_alias() on buggered fs image picking a reference > to your subdirectory when doing a lookup elsewhere. It can relocate the > damn thing, without rename() being allowed for _anything_. You're talking about directory hard links, right? E.g. if there's a directory with two links a/dir and b/dir, and fscrypt_d_revalidate() is running on 'dir' via a lookup in a/, it could be the case that b/dir is being concurrently looked up. Then the concurrent d_splice_alias() will move the whole dentry tree rooted at 'dir' from a/ to b/ in the dcache. Okay, it looks like you're right; I'll update my comment to clarify that dget_parent() is still needed... - Eric