Skip to content

Commit c4704a4

Browse files
ebiggerstytso
authored andcommitted
ext4: do not advertise encryption support when disabled
The sysfs file /sys/fs/ext4/features/encryption was present on kernels compiled with CONFIG_EXT4_FS_ENCRYPTION=n. This was misleading because such kernels do not actually support ext4 encryption. Therefore, only provide this file on kernels compiled with CONFIG_EXT4_FS_ENCRYPTION=y. Note: since the ext4 feature files are all hardcoded to have a contents of "supported", it really is the presence or absence of the file that is significant, not the contents (and this change reflects that). Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org
1 parent 559cce6 commit c4704a4

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

fs/ext4/sysfs.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,14 +223,18 @@ static struct attribute *ext4_attrs[] = {
223223
EXT4_ATTR_FEATURE(lazy_itable_init);
224224
EXT4_ATTR_FEATURE(batched_discard);
225225
EXT4_ATTR_FEATURE(meta_bg_resize);
226+
#ifdef CONFIG_EXT4_FS_ENCRYPTION
226227
EXT4_ATTR_FEATURE(encryption);
228+
#endif
227229
EXT4_ATTR_FEATURE(metadata_csum_seed);
228230

229231
static struct attribute *ext4_feat_attrs[] = {
230232
ATTR_LIST(lazy_itable_init),
231233
ATTR_LIST(batched_discard),
232234
ATTR_LIST(meta_bg_resize),
235+
#ifdef CONFIG_EXT4_FS_ENCRYPTION
233236
ATTR_LIST(encryption),
237+
#endif
234238
ATTR_LIST(metadata_csum_seed),
235239
NULL,
236240
};

0 commit comments

Comments
 (0)