Browse files

Fix for vmalloc failure with modprobe and cutdown kernel

  • Loading branch information...
1 parent c1e6924 commit 46d14862c3e91a866883c93be8c6c78ffd149439 @popcornmix popcornmix committed Aug 29, 2012
Showing with 16 additions and 13 deletions.
  1. +16 −13 kernel/module.c
View
29 kernel/module.c
@@ -2604,20 +2604,23 @@ static int move_module(struct module *mod, struct load_info *info)
memset(ptr, 0, mod->core_size);
mod->module_core = ptr;
- ptr = module_alloc_update_bounds(mod->init_size);
- /*
- * The pointer to this block is stored in the module structure
- * which is inside the block. This block doesn't need to be
- * scanned as it contains data and code that will be freed
- * after the module is initialized.
- */
- kmemleak_ignore(ptr);
- if (!ptr && mod->init_size) {
- module_free(mod, mod->module_core);
- return -ENOMEM;
+ if (mod->init_size) {
+ ptr = module_alloc_update_bounds(mod->init_size);
+ /*
+ * The pointer to this block is stored in the module structure
+ * which is inside the block. This block doesn't need to be
+ * scanned as it contains data and code that will be freed
+ * after the module is initialized.
+ */
+ kmemleak_ignore(ptr);
+ if (!ptr && mod->init_size) {
+ module_free(mod, mod->module_core);
+ return -ENOMEM;
+ }
+ memset(ptr, 0, mod->init_size);
+ mod->module_init = ptr;
}
- memset(ptr, 0, mod->init_size);
- mod->module_init = ptr;
+ else mod->module_init = NULL;
/* Transfer each section which specifies SHF_ALLOC */
DEBUGP("final section addresses:\n");

0 comments on commit 46d1486

Please sign in to comment.