Merge branch 'akpm' (patches from Andrew)
[linux-2.6-microblaze.git] / kernel / module.c
index 0f11eae..9d9f240 100644 (file)
@@ -3014,7 +3014,7 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
        if (info->len < sizeof(*(info->hdr)))
                return -ENOEXEC;
 
-       err = security_kernel_load_data(LOADING_MODULE);
+       err = security_kernel_load_data(LOADING_MODULE, true);
        if (err)
                return err;
 
@@ -3024,11 +3024,17 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
                return -ENOMEM;
 
        if (copy_chunked_from_user(info->hdr, umod, info->len) != 0) {
-               vfree(info->hdr);
-               return -EFAULT;
+               err = -EFAULT;
+               goto out;
        }
 
-       return 0;
+       err = security_kernel_post_load_data((char *)info->hdr, info->len,
+                                            LOADING_MODULE, "init_module");
+out:
+       if (err)
+               vfree(info->hdr);
+
+       return err;
 }
 
 static void free_copy(struct load_info *info)
@@ -3275,6 +3281,11 @@ static int find_module_sections(struct module *mod, struct load_info *info)
        mod->kprobe_blacklist = section_objs(info, "_kprobe_blacklist",
                                                sizeof(unsigned long),
                                                &mod->num_kprobe_blacklist);
+#endif
+#ifdef CONFIG_HAVE_STATIC_CALL_INLINE
+       mod->static_call_sites = section_objs(info, ".static_call_sites",
+                                             sizeof(*mod->static_call_sites),
+                                             &mod->num_static_call_sites);
 #endif
        mod->extable = section_objs(info, "__ex_table",
                                    sizeof(*mod->extable), &mod->num_exentries);
@@ -3793,9 +3804,13 @@ static int prepare_coming_module(struct module *mod)
        if (err)
                return err;
 
-       blocking_notifier_call_chain(&module_notify_list,
-                                    MODULE_STATE_COMING, mod);
-       return 0;
+       err = blocking_notifier_call_chain_robust(&module_notify_list,
+                       MODULE_STATE_COMING, MODULE_STATE_GOING, mod);
+       err = notifier_to_errno(err);
+       if (err)
+               klp_module_going(mod);
+
+       return err;
 }
 
 static int unknown_module_param_cb(char *param, char *val, const char *modname,
@@ -4048,7 +4063,7 @@ SYSCALL_DEFINE3(finit_module, int, fd, const char __user *, uargs, int, flags)
                      |MODULE_INIT_IGNORE_VERMAGIC))
                return -EINVAL;
 
-       err = kernel_read_file_from_fd(fd, &hdr, INT_MAX, NULL,
+       err = kernel_read_file_from_fd(fd, 0, &hdr, INT_MAX, NULL,
                                       READING_MODULE);
        if (err < 0)
                return err;