From patchwork Thu Mar 15 10:51:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sheng Yong X-Patchwork-Id: 10284223 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0EDF360386 for ; Thu, 15 Mar 2018 10:51:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F432287E5 for ; Thu, 15 Mar 2018 10:51:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03A29288F4; Thu, 15 Mar 2018 10:51:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A52F5287E5 for ; Thu, 15 Mar 2018 10:51:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751617AbeCOKv5 (ORCPT ); Thu, 15 Mar 2018 06:51:57 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:60875 "EHLO huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751585AbeCOKv4 (ORCPT ); Thu, 15 Mar 2018 06:51:56 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id BDB2DECCEA371; Thu, 15 Mar 2018 18:51:53 +0800 (CST) Received: from HULK-Android.huawei.com (10.113.189.218) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.361.1; Thu, 15 Mar 2018 18:51:45 +0800 From: Sheng Yong To: , , , CC: , , Subject: [RFC PATCH v5 3/3] ext4: do not allow mount with test_dummy_encryption if encrypt not set Date: Thu, 15 Mar 2018 18:51:43 +0800 Message-ID: <20180315105143.133050-4-shengyong1@huawei.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180315105143.133050-1-shengyong1@huawei.com> References: <20180315105143.133050-1-shengyong1@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.113.189.218] X-CFilter-Loop: Reflected Sender: linux-fscrypt-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fscrypt@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When mounting with test_dummy_encryption option, if encrypt feature is not set, return fail instead of setting encrypt feature forcely. Cc: linux-ext4@vger.kernel.org Signed-off-by: Sheng Yong --- fs/ext4/super.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 39bf464c35f1..1a253342b09e 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4149,10 +4149,9 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount_wq; } - if (DUMMY_ENCRYPTION_ENABLED(sbi) && !sb_rdonly(sb) && - !ext4_has_feature_encrypt(sb)) { - ext4_set_feature_encrypt(sb); - ext4_commit_super(sb, 1); + if (DUMMY_ENCRYPTION_ENABLED(sbi) && !ext4_has_feature_encrypt(sb)) { + ext4_msg(sb, KERN_ERR, "Encrypt does not support"); + goto failed_mount_wq; } /*