Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755541AbbFMDpy (ORCPT ); Fri, 12 Jun 2015 23:45:54 -0400 Received: from imap.thunk.org ([74.207.234.97]:34620 "EHLO imap.thunk.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755325AbbFMDpt (ORCPT ); Fri, 12 Jun 2015 23:45:49 -0400 Date: Fri, 12 Jun 2015 23:45:46 -0400 From: "Theodore Ts'o" To: Seunghun Lee Cc: linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ext4 crypto: prevent mount when blocksize != pagesize Message-ID: <20150613034546.GN24181@thunk.org> Mail-Followup-To: Theodore Ts'o , Seunghun Lee , linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org References: <1434035567-12651-1-git-send-email-waydi1@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1434035567-12651-1-git-send-email-waydi1@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: tytso@thunk.org X-SA-Exim-Scanned: No (on imap.thunk.org); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1733 Lines: 49 On Fri, Jun 12, 2015 at 12:12:47AM +0900, Seunghun Lee wrote: > Encryption mode is unsupported when blocksize != pagesize. > > Signed-off-by: Seunghun Lee This only checks for blocksize != pagesize in the case where the test dummy encryption mount option is given. We need to check also for the case when the file system has the encryption feature set. So this is the better check. - Ted commit 660947160c07e42b6c5def33a1977da09567ed55 Author: Theodore Ts'o Date: Fri Jun 12 23:44:33 2015 -0400 ext4 crypto: fail the mount if blocksize != pagesize We currently don't correctly handle the case where blocksize != pagesize, so disallow the mount in those cases. Signed-off-by: Theodore Ts'o diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 31e85be..e13fe40 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -4065,7 +4065,15 @@ no_journal: } } - if (unlikely(sbi->s_mount_flags & EXT4_MF_TEST_DUMMY_ENCRYPTION) && + if ((DUMMY_ENCRYPTION_ENABLED(sbi) || + EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) && + (blocksize != PAGE_CACHE_SIZE)) { + ext4_msg(sb, KERN_ERR, + "Unsupported blocksize for fs encryption"); + goto failed_mount_wq; + } + + if (DUMMY_ENCRYPTION_ENABLED(sbi) && !(sb->s_flags & MS_RDONLY) && !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) { EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/