From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2118EC2D0A3 for ; Sun, 1 Nov 2020 10:39:10 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B8D8E2071A for ; Sun, 1 Nov 2020 10:39:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="20wCbJRb"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="xag3wNPN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B8D8E2071A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-ID:In-Reply-To:Date:From:To: Subject:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:References:List-Owner; bh=JU7NH/rHIMLswK/MPDocuj2/nf7zZFiZomvLI1s6OtI=; b=20wCbJRbRhGAiFfTJ9zKq/bD6 slB9NwI+/qnUpBisOIBAaHIq5S+M3mfrSV+mg4JP2fptfcNQTHwS24XSZIILCvNcORaHfQwk5PQkS sURgxws0xXg/7ytMxPmfvMg2xKo7fwkv8znWqV/uiPWxJ/BjzrJXRbeSt/gfP9RibyirD08vgw2bq f163/D05Z1Ia/VzwkbT08ys9IbBrRlOLpWDVoH9RekO4i+Ogk0P/4Gu1PRx8FJK4qeJtpm6DGY4Wh DMtrQPnRuxv+4Zqi2cnkXSnaMcoPVC5JYx1jnQy8CzlIJebQr6FFUi+4eJh5PJTb9faD3lGIhpvBd tksX6iJKw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZAkh-0003Ke-OR; Sun, 01 Nov 2020 10:38:23 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kZAke-0003K9-Ca for linux-mtd@lists.infradead.org; Sun, 01 Nov 2020 10:38:21 +0000 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id C5B7C2071A; Sun, 1 Nov 2020 10:38:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604227098; bh=xR+9Q6L+wKEyIZDuGGpAuB2SwvzwqkLJaS4lNusDwjI=; h=Subject:To:Cc:From:Date:In-Reply-To:From; b=xag3wNPNGlG1/7KDu/+UZI5Q84X4MaHquUO28r2owU/ZMn4PQ5WgSvNtzdyB0sykG e5X2Sl+c56pjGNJJKg9ZAq4SHPZmL8aYTAao4VzPWrVy0/6Yq8Ir39CShS2ga+CFEg LWh51tN4qbixx6d3BaXML64JTxgFYdrzsNTEpTqg= Subject: Patch "fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory" has been added to the 4.19-stable tree To: ebiggers@google.com, ebiggers@kernel.org, gregkh@linuxfoundation.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, sarthakkukreti@chromium.org, tytso@mit.edu From: Date: Sun, 01 Nov 2020 11:39:02 +0100 In-Reply-To: <20201031220553.1085782-4-ebiggers@kernel.org> Message-ID: <16042271428367@kroah.com> MIME-Version: 1.0 X-stable: commit X-Patchwork-Hint: ignore X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201101_053820_570836_88CA1F9E X-CRM114-Status: GOOD ( 14.14 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: stable-commits@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org This is a note to let you know that I've just added the patch titled fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: fs-fscrypt-clear-dcache_encrypted_name-when-unaliasing-directory.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Sun Nov 1 11:35:18 AM CET 2020 From: Eric Biggers Date: Sat, 31 Oct 2020 15:05:51 -0700 Subject: fs, fscrypt: clear DCACHE_ENCRYPTED_NAME when unaliasing directory To: stable@vger.kernel.org Cc: linux-fscrypt@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mtd@lists.infradead.org, Sarthak Kukreti , Theodore Ts'o Message-ID: <20201031220553.1085782-4-ebiggers@kernel.org> From: Eric Biggers commit 0bf3d5c1604ecbbd4e49e9f5b3c79152b87adb0d upstream. Make __d_move() clear DCACHE_ENCRYPTED_NAME on the source dentry. This is needed for when d_splice_alias() moves a directory's encrypted alias to its decrypted alias as a result of the encryption key being added. Otherwise, the decrypted alias will incorrectly be invalidated on the next lookup, causing problems such as unmounting a mount the user just mount()ed there. Note that we don't have to support arbitrary moves of this flag because fscrypt doesn't allow dentries with DCACHE_ENCRYPTED_NAME to be the source or target of a rename(). Fixes: 28b4c263961c ("ext4 crypto: revalidate dentry after adding or removing the key") Reported-by: Sarthak Kukreti Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o Signed-off-by: Greg Kroah-Hartman --- fs/dcache.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2713,6 +2713,20 @@ static void copy_name(struct dentry *den } /* + * When d_splice_alias() moves a directory's encrypted alias to its decrypted + * alias as a result of the encryption key being added, DCACHE_ENCRYPTED_NAME + * must be cleared. Note that we don't have to support arbitrary moves of this + * flag because fscrypt doesn't allow encrypted aliases to be the source or + * target of a rename(). + */ +static inline void fscrypt_handle_d_move(struct dentry *dentry) +{ +#if IS_ENABLED(CONFIG_FS_ENCRYPTION) + dentry->d_flags &= ~DCACHE_ENCRYPTED_NAME; +#endif +} + +/* * __d_move - move a dentry * @dentry: entry to move * @target: new dentry @@ -2787,6 +2801,7 @@ static void __d_move(struct dentry *dent list_move(&dentry->d_child, &dentry->d_parent->d_subdirs); __d_rehash(dentry); fsnotify_update_flags(dentry); + fscrypt_handle_d_move(dentry); write_seqcount_end(&target->d_seq); write_seqcount_end(&dentry->d_seq); Patches currently in stable-queue which might be from ebiggers@kernel.org are queue-4.19/fscrypt-only-set-dentry_operations-on-ciphertext-dentries.patch queue-4.19/fscrypt-clean-up-and-improve-dentry-revalidation.patch queue-4.19/fscrypt-fix-race-allowing-rename-and-link-of-ciphertext-dentries.patch queue-4.19/fs-fscrypt-clear-dcache_encrypted_name-when-unaliasing-directory.patch queue-4.19/fscrypt-fix-race-where-lookup-marks-plaintext-dentry-as-ciphertext.patch ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/