add patch use_GFP_NOFS_in_jbd2_cleanup_journal_tail
[ext4-patch-queue.git] / crypto-check-blocksize-eq-pagesize
blob95b707364bbc39ac0737cc63c05b359f05f36341
1 ext4 crypto: fail the mount if blocksize != pagesize
3 We currently don't correctly handle the case where blocksize !=
4 pagesize, so disallow the mount in those cases.
6 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
7 ---
8  fs/ext4/super.c | 10 +++++++++-
9  1 file changed, 9 insertions(+), 1 deletion(-)
11 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
12 index 31e85be..e13fe40 100644
13 --- a/fs/ext4/super.c
14 +++ b/fs/ext4/super.c
15 @@ -4065,7 +4065,15 @@ no_journal:
16                 }
17         }
19 -       if (unlikely(sbi->s_mount_flags & EXT4_MF_TEST_DUMMY_ENCRYPTION) &&
20 +       if ((DUMMY_ENCRYPTION_ENABLED(sbi) ||
21 +            EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) &&
22 +           (blocksize != PAGE_CACHE_SIZE)) {
23 +               ext4_msg(sb, KERN_ERR,
24 +                        "Unsupported blocksize for fs encryption");
25 +               goto failed_mount_wq;
26 +       }
28 +       if (DUMMY_ENCRYPTION_ENABLED(sbi) &&
29             !(sb->s_flags & MS_RDONLY) &&
30             !EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT)) {
31                 EXT4_SET_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_ENCRYPT);