From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Theodore Ts'o" Subject: Re: [PATCH v2 2/5] fscrypt: fix race allowing rename() and link() of ciphertext dentries Date: Wed, 17 Apr 2019 09:53:19 -0400 Message-ID: <20190417135319.GB4686@mit.edu> References: <20190320183913.12686-1-ebiggers@kernel.org> <20190320183913.12686-3-ebiggers@kernel.org> 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 1hGl0O-0000lf-Lt for linux-f2fs-devel@lists.sourceforge.net; Wed, 17 Apr 2019 13:53:40 +0000 Received: from outgoing-auth-1.mit.edu ([18.9.28.11] helo=outgoing.mit.edu) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) id 1hGl0M-00BOY4-Ub for linux-f2fs-devel@lists.sourceforge.net; Wed, 17 Apr 2019 13:53:40 +0000 Content-Disposition: inline In-Reply-To: <20190320183913.12686-3-ebiggers@kernel.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net To: Eric Biggers 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 Wed, Mar 20, 2019 at 11:39:10AM -0700, Eric Biggers wrote: > From: Eric Biggers > > Close some race conditions where fscrypt allowed rename() and link() on > ciphertext dentries that had been looked up just prior to the key being > concurrently added. It's better to return -ENOKEY in this case. > > This avoids doing the nonsensical thing of encrypting the names a second > time when searching for the actual on-disk dir entries. It also > guarantees that DCACHE_ENCRYPTED_NAME dentries are never rename()d, so > the dcache won't have support all possible combinations of moving > DCACHE_ENCRYPTED_NAME around during __d_move(). > > Signed-off-by: Eric Biggers Looks good, applied. - Ted