aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/module.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/module.c')
-rw-r--r--kernel/module.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/kernel/module.c b/kernel/module.c
index 2383e60fcf3f..278e9b6762bb 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -73,6 +73,9 @@ DEFINE_MUTEX(module_mutex);
73EXPORT_SYMBOL_GPL(module_mutex); 73EXPORT_SYMBOL_GPL(module_mutex);
74static LIST_HEAD(modules); 74static LIST_HEAD(modules);
75 75
76/* Block module loading/unloading? */
77int modules_disabled = 0;
78
76/* Waiting for a module to finish initializing? */ 79/* Waiting for a module to finish initializing? */
77static DECLARE_WAIT_QUEUE_HEAD(module_wq); 80static DECLARE_WAIT_QUEUE_HEAD(module_wq);
78 81
@@ -778,7 +781,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
778 char name[MODULE_NAME_LEN]; 781 char name[MODULE_NAME_LEN];
779 int ret, forced = 0; 782 int ret, forced = 0;
780 783
781 if (!capable(CAP_SYS_MODULE)) 784 if (!capable(CAP_SYS_MODULE) || modules_disabled)
782 return -EPERM; 785 return -EPERM;
783 786
784 if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) 787 if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0)
@@ -2338,7 +2341,7 @@ SYSCALL_DEFINE3(init_module, void __user *, umod,
2338 int ret = 0; 2341 int ret = 0;
2339 2342
2340 /* Must have permission */ 2343 /* Must have permission */
2341 if (!capable(CAP_SYS_MODULE)) 2344 if (!capable(CAP_SYS_MODULE) || modules_disabled)
2342 return -EPERM; 2345 return -EPERM;
2343 2346
2344 /* Only one module load at a time, please */ 2347 /* Only one module load at a time, please */