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