Skip to content

Commit 5f49832

Browse files
committed
Merge tag 'x86-mm-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 mm update from Ingo Molnar: "Do not create the x86/init_pkru debugfs file if the CPU doesn't support PKRU" * tag 'x86-mm-2021-06-28' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/pkeys: Skip 'init_pkru' debugfs file creation when pkeys not supported
2 parents e98e886 + 314a1e1 commit 5f49832

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/x86/mm/pkeys.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,10 @@ static const struct file_operations fops_init_pkru = {
192192

193193
static int __init create_init_pkru_value(void)
194194
{
195+
/* Do not expose the file if pkeys are not supported. */
196+
if (!cpu_feature_enabled(X86_FEATURE_OSPKE))
197+
return 0;
198+
195199
debugfs_create_file("init_pkru", S_IRUSR | S_IWUSR,
196200
arch_debugfs_dir, NULL, &fops_init_pkru);
197201
return 0;

0 commit comments

Comments
 (0)