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=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 EDA3BC74A4B for ; Thu, 11 Jul 2019 11:31:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6EDF21655 for ; Thu, 11 Jul 2019 11:31:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562844677; bh=6SE+sm/BxryTbMPLn9RmtVfZTyk4xygGBEbvNUeQ8Nk=; h=Subject:To:Cc:From:Date:List-ID:From; b=Wrlk0PSSCFYSPC0VJQSaXBUiBF+oVAAxaX9aG/EJataLoR70JPG9IAneqfjMp+fl0 F3aUHSBjd9a9Ctsefbf8MTcGI6AD6/kbwuECQayThu7xXhdFjkmjav2K2qRLoIMqyZ G0Bfrte3QyAH4I/zefsO1W/LZnNihI8AJWaPMNhI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728354AbfGKLbR (ORCPT ); Thu, 11 Jul 2019 07:31:17 -0400 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]:43249 "EHLO wout3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728102AbfGKLbQ (ORCPT ); Thu, 11 Jul 2019 07:31:16 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id A1A924B5; Thu, 11 Jul 2019 07:31:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Thu, 11 Jul 2019 07:31:15 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=CxCn5o FsAV4PwZgyV77WxPFsXqJt6xFz51Addt7AM/Q=; b=YeIZPIDiqRyLj7yMRbK2o4 4xEKqZUtldi6TSyH7BxUeQ0TMlyG1EF2wJSKMYuVH51Rpkdz5fBK+mbsovBrtE80 dPNlj07TVH10y7zSdhzK/CZIJIVscWJnDDY7RFqzbaIt7Di2qxxIc9n8KDjrUrws SWFoYVK7xczoEfRl3AXGHmMNmAhAyH8ZjmyxskG3yA4qShQm7rtNTKlRcKc//X97 fFnIAJyxUPsqa6iTH8alWLwi2ly2DnH5mwo0BOLC2xhtdeb/tv0t48wit/k1ZnwX 10L9nBjHcbuHtLMpvCtDs2cB2fDieb3Gfre+OsDj7h6QNUanv/duU2Ri+NxGo7Gg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduvddrgeekgdegfecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecunecujfgurhepuffvhfffkfggtgfgsehtkeertddttd flnecuhfhrohhmpeeoghhrvghgkhhhsehlihhnuhigfhhouhhnuggrthhiohhnrdhorhhg qeenucfkphepkeefrdekiedrkeelrddutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hgrhgvgheskhhrohgrhhdrtghomhenucevlhhushhtvghrufhiiigvpedu X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id D8B0D80064; Thu, 11 Jul 2019 07:31:14 -0400 (EDT) Subject: FAILED: patch "[PATCH] fscrypt: don't set policy for a dead directory" failed to apply to 4.4-stable tree To: hongjiefang@asrmicro.com, ebiggers@google.com, stable@vger.kernel.org Cc: From: Date: Thu, 11 Jul 2019 13:31:04 +0200 Message-ID: <1562844664145128@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 5858bdad4d0d0fc18bf29f34c3ac836e0b59441f Mon Sep 17 00:00:00 2001 From: Hongjie Fang Date: Wed, 22 May 2019 10:02:53 +0800 Subject: [PATCH] fscrypt: don't set policy for a dead directory The directory may have been removed when entering fscrypt_ioctl_set_policy(). If so, the empty_dir() check will return error for ext4 file system. ext4_rmdir() sets i_size = 0, then ext4_empty_dir() reports an error because 'inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2)'. If the fs is mounted with errors=panic, it will trigger a panic issue. Add the check IS_DEADDIR() to fix this problem. Fixes: 9bd8212f981e ("ext4 crypto: add encryption policy and password salt support") Cc: # v4.1+ Signed-off-by: Hongjie Fang Signed-off-by: Eric Biggers diff --git a/fs/crypto/policy.c b/fs/crypto/policy.c index d536889ac31b..4941fe8471ce 100644 --- a/fs/crypto/policy.c +++ b/fs/crypto/policy.c @@ -81,6 +81,8 @@ int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg) if (ret == -ENODATA) { if (!S_ISDIR(inode->i_mode)) ret = -ENOTDIR; + else if (IS_DEADDIR(inode)) + ret = -ENOENT; else if (!inode->i_sb->s_cop->empty_dir(inode)) ret = -ENOTEMPTY; else