hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/acpi/custom_method.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * custom_method.c - debugfs interface for customizing ACPI control method
34 */
....@@ -8,11 +9,10 @@
89 #include <linux/uaccess.h>
910 #include <linux/debugfs.h>
1011 #include <linux/acpi.h>
12
+#include <linux/security.h>
1113
1214 #include "internal.h"
1315
14
-#define _COMPONENT ACPI_SYSTEM_COMPONENT
15
-ACPI_MODULE_NAME("custom_method");
1616 MODULE_LICENSE("GPL");
1717
1818 static struct dentry *cm_dentry;
....@@ -28,6 +28,11 @@
2828
2929 struct acpi_table_header table;
3030 acpi_status status;
31
+ int ret;
32
+
33
+ ret = security_locked_down(LOCKDOWN_ACPI_TABLES);
34
+ if (ret)
35
+ return ret;
3136
3237 if (!(*ppos)) {
3338 /* parse the table header to get the table length */
....@@ -84,21 +89,14 @@
8489
8590 static int __init acpi_custom_method_init(void)
8691 {
87
- if (acpi_debugfs_dir == NULL)
88
- return -ENOENT;
89
-
9092 cm_dentry = debugfs_create_file("custom_method", S_IWUSR,
9193 acpi_debugfs_dir, NULL, &cm_fops);
92
- if (cm_dentry == NULL)
93
- return -ENODEV;
94
-
9594 return 0;
9695 }
9796
9897 static void __exit acpi_custom_method_exit(void)
9998 {
100
- if (cm_dentry)
101
- debugfs_remove(cm_dentry);
99
+ debugfs_remove(cm_dentry);
102100 }
103101
104102 module_init(acpi_custom_method_init);