]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.8.5/ext4-do-not-advertise-encryption-support-when-disabled.patch
4.9-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.8.5 / ext4-do-not-advertise-encryption-support-when-disabled.patch
CommitLineData
4f0a39a2
GKH
1From c4704a4fbe834eee4109ca064131d440941f6235 Mon Sep 17 00:00:00 2001
2From: Eric Biggers <ebiggers@google.com>
3Date: Wed, 12 Oct 2016 23:24:51 -0400
4Subject: ext4: do not advertise encryption support when disabled
5
6From: Eric Biggers <ebiggers@google.com>
7
8commit c4704a4fbe834eee4109ca064131d440941f6235 upstream.
9
10The sysfs file /sys/fs/ext4/features/encryption was present on kernels
11compiled with CONFIG_EXT4_FS_ENCRYPTION=n. This was misleading because
12such kernels do not actually support ext4 encryption. Therefore, only
13provide this file on kernels compiled with CONFIG_EXT4_FS_ENCRYPTION=y.
14
15Note: since the ext4 feature files are all hardcoded to have a contents
16of "supported", it really is the presence or absence of the file that is
17significant, not the contents (and this change reflects that).
18
19Signed-off-by: Eric Biggers <ebiggers@google.com>
20Signed-off-by: Theodore Ts'o <tytso@mit.edu>
21Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
22
23---
24 fs/ext4/sysfs.c | 4 ++++
25 1 file changed, 4 insertions(+)
26
27--- a/fs/ext4/sysfs.c
28+++ b/fs/ext4/sysfs.c
29@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] =
30 EXT4_ATTR_FEATURE(lazy_itable_init);
31 EXT4_ATTR_FEATURE(batched_discard);
32 EXT4_ATTR_FEATURE(meta_bg_resize);
33+#ifdef CONFIG_EXT4_FS_ENCRYPTION
34 EXT4_ATTR_FEATURE(encryption);
35+#endif
36 EXT4_ATTR_FEATURE(metadata_csum_seed);
37
38 static struct attribute *ext4_feat_attrs[] = {
39 ATTR_LIST(lazy_itable_init),
40 ATTR_LIST(batched_discard),
41 ATTR_LIST(meta_bg_resize),
42+#ifdef CONFIG_EXT4_FS_ENCRYPTION
43 ATTR_LIST(encryption),
44+#endif
45 ATTR_LIST(metadata_csum_seed),
46 NULL,
47 };