patch-2.1.21 linux/kernel/module.c

Next file: linux/net/802/p8022.c
Previous file: linux/kernel/ksyms.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.20/linux/kernel/module.c linux/kernel/module.c
@@ -43,9 +43,7 @@
 	NULL,			/* cleanup */
 	__start___ex_table,	/* ex_table_start */
 	__stop___ex_table,	/* ex_table_end */
-#ifdef __alpha__
-	NULL,			/* gp */
-#endif
+	/* Rest are NULL */
 };
 
 struct module *module_list = &kernel_module;
@@ -186,11 +184,14 @@
 		goto err1;
 	}
 
-	/* In the future we can check for various known sizes, but for
-	   now there is only one.  */
+	/* Check for legal module header sizes.  */
 	if ((error = get_user(mod_user_size, &mod_user->size_of_struct)) != 0)
 		goto err1;
-	if (mod_user_size != sizeof(struct module)) {
+	switch (mod_user_size) {
+	  case sizeof(struct module):
+	  case &((struct module *)0L)->persist_start:
+		break;
+	  default:
 		printk(KERN_ERR "init_module: Invalid module header size.\n"
 		       KERN_ERR "A new version of the modutils is likely "
 				"needed.\n");
@@ -378,8 +379,9 @@
 		next = mod->next;
 		if (mod->refs == NULL &&
 		    mod->usecount == 0 &&
-		    ((mod->flags & (MOD_AUTOCLEAN|MOD_RUNNING|MOD_DELETED))
-		     == (MOD_AUTOCLEAN|MOD_RUNNING))) {
+		    ((mod->flags
+		      & (MOD_AUTOCLEAN|MOD_RUNNING|MOD_DELETED|MOD_USED_ONCE))
+		     == (MOD_AUTOCLEAN|MOD_RUNNING|MOD_USED_ONCE))) {
 			if (mod->flags & MOD_VISITED)
 				mod->flags &= ~MOD_VISITED;
 			else

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov