patch-2.1.44 linux/kernel/module.c

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

diff -u --recursive --new-file v2.1.43/linux/kernel/module.c linux/kernel/module.c
@@ -79,7 +79,8 @@
 	unsigned long page;
 	long retval;
 
-	if ((unsigned long)user_name >= TASK_SIZE)
+	if ((unsigned long)user_name >= TASK_SIZE
+	    && get_fs () != KERNEL_DS)
 		return -EFAULT;
 
 	page = __get_free_page(GFP_KERNEL);
@@ -134,7 +135,7 @@
 		error = -EEXIST;
 		goto err1;
 	}
-	if ((mod = (struct module *)vmalloc(size)) == NULL) {
+	if ((mod = (struct module *)module_map(size)) == NULL) {
 		error = -ENOMEM;
 		goto err1;
 	}
@@ -685,6 +686,7 @@
 {
 	struct module *mod;
 	int i;
+	struct kernel_sym ksym;
 
 	lock_kernel();
 	for (mod = module_list, i = 0; mod; mod = mod->next) {
@@ -695,8 +697,10 @@
 	if (table == NULL)
 		goto out;
 
+	/* So that we don't give the user our stack content */
+	memset (&ksym, 0, sizeof (ksym));
+
 	for (mod = module_list, i = 0; mod; mod = mod->next) {
-		struct kernel_sym ksym;
 		struct module_symbol *msym;
 		unsigned int j;
 
@@ -790,7 +794,7 @@
 
 	/* And free the memory.  */
 
-	vfree(mod);
+	module_unmap(mod);
 }
 
 /*

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