diff options
Diffstat (limited to 'kernel/module.c')
-rw-r--r-- | kernel/module.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/kernel/module.c b/kernel/module.c index 1ecf08106381..f77e893e4620 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -653,11 +653,20 @@ static void wait_for_zero_refcount(struct module *mod) | |||
653 | mutex_lock(&module_mutex); | 653 | mutex_lock(&module_mutex); |
654 | } | 654 | } |
655 | 655 | ||
656 | int delete_module(const char *name, unsigned int flags) | 656 | asmlinkage long |
657 | sys_delete_module(const char __user *name_user, unsigned int flags) | ||
657 | { | 658 | { |
658 | struct module *mod; | 659 | struct module *mod; |
660 | char name[MODULE_NAME_LEN]; | ||
659 | int ret, forced = 0; | 661 | int ret, forced = 0; |
660 | 662 | ||
663 | if (!capable(CAP_SYS_MODULE)) | ||
664 | return -EPERM; | ||
665 | |||
666 | if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) | ||
667 | return -EFAULT; | ||
668 | name[MODULE_NAME_LEN-1] = '\0'; | ||
669 | |||
661 | if (mutex_lock_interruptible(&module_mutex) != 0) | 670 | if (mutex_lock_interruptible(&module_mutex) != 0) |
662 | return -EINTR; | 671 | return -EINTR; |
663 | 672 | ||
@@ -718,21 +727,6 @@ int delete_module(const char *name, unsigned int flags) | |||
718 | return ret; | 727 | return ret; |
719 | } | 728 | } |
720 | 729 | ||
721 | asmlinkage long | ||
722 | sys_delete_module(const char __user *name_user, unsigned int flags) | ||
723 | { | ||
724 | char name[MODULE_NAME_LEN]; | ||
725 | |||
726 | if (!capable(CAP_SYS_MODULE)) | ||
727 | return -EPERM; | ||
728 | |||
729 | if (strncpy_from_user(name, name_user, MODULE_NAME_LEN-1) < 0) | ||
730 | return -EFAULT; | ||
731 | name[MODULE_NAME_LEN-1] = '\0'; | ||
732 | |||
733 | return delete_module(name, flags); | ||
734 | } | ||
735 | |||
736 | static void print_unload_info(struct seq_file *m, struct module *mod) | 730 | static void print_unload_info(struct seq_file *m, struct module *mod) |
737 | { | 731 | { |
738 | struct module_use *use; | 732 | struct module_use *use; |