]>
Commit | Line | Data |
---|---|---|
4f0a39a2 GKH |
1 | From c4704a4fbe834eee4109ca064131d440941f6235 Mon Sep 17 00:00:00 2001 |
2 | From: Eric Biggers <ebiggers@google.com> | |
3 | Date: Wed, 12 Oct 2016 23:24:51 -0400 | |
4 | Subject: ext4: do not advertise encryption support when disabled | |
5 | ||
6 | From: Eric Biggers <ebiggers@google.com> | |
7 | ||
8 | commit c4704a4fbe834eee4109ca064131d440941f6235 upstream. | |
9 | ||
10 | The sysfs file /sys/fs/ext4/features/encryption was present on kernels | |
11 | compiled with CONFIG_EXT4_FS_ENCRYPTION=n. This was misleading because | |
12 | such kernels do not actually support ext4 encryption. Therefore, only | |
13 | provide this file on kernels compiled with CONFIG_EXT4_FS_ENCRYPTION=y. | |
14 | ||
15 | Note: since the ext4 feature files are all hardcoded to have a contents | |
16 | of "supported", it really is the presence or absence of the file that is | |
17 | significant, not the contents (and this change reflects that). | |
18 | ||
19 | Signed-off-by: Eric Biggers <ebiggers@google.com> | |
20 | Signed-off-by: Theodore Ts'o <tytso@mit.edu> | |
21 | Signed-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 | }; |