patch-2.3.27 linux/fs/exec.c

Next file: linux/fs/ext2/file.c
Previous file: linux/fs/coda/sysctl.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.26/linux/fs/exec.c linux/fs/exec.c
@@ -225,17 +225,13 @@
 			page = bprm->page[i];
 			new = 0;
 			if (!page) {
-				/*
-				 * Cannot yet use highmem page because
-				 * we cannot sleep with a kmap held.
-				 */
-				page = __get_pages(GFP_USER, 0);
+				page = alloc_page(GFP_HIGHUSER);
 				bprm->page[i] = page;
 				if (!page)
 					return -ENOMEM;
 				new = 1;
 			}
-			kaddr = (char *)kmap(page, KM_WRITE);
+			kaddr = (char *)kmap(page);
 
 			if (new && offset)
 				memset(kaddr, 0, offset);
@@ -247,7 +243,7 @@
 			}
 			err = copy_from_user(kaddr + offset, str, bytes_to_copy);
 			flush_page_to_ram(page);
-			kunmap((unsigned long)kaddr, KM_WRITE);
+			kunmap(page);
 
 			if (err)
 				return -EFAULT; 
@@ -462,6 +458,7 @@
 	/*
 	 * Make sure we have a private signal table
 	 */
+	task_lock(current);
 	oldsig = current->sig;
 	retval = make_private_signals();
 	if (retval) goto flush_failed;
@@ -500,6 +497,7 @@
 			
 	flush_signal_handlers(current);
 	flush_old_files(current->files);
+	task_unlock(current);
 
 	return 0;
 
@@ -508,6 +506,7 @@
 		kfree(current->sig);
 flush_failed:
 	current->sig = oldsig;
+	task_unlock(current);
 	return retval;
 }
 
@@ -681,12 +680,12 @@
 			if (offset != PAGE_SIZE)
 				continue;
 			offset = 0;
-			kunmap((unsigned long)kaddr, KM_WRITE);
+			kunmap(page);
 inside:
 			page = bprm->page[bprm->p/PAGE_SIZE];
-			kaddr = (char *)kmap(page, KM_WRITE);
+			kaddr = (char *)kmap(page);
 		}
-		kunmap((unsigned long)kaddr, KM_WRITE);
+		kunmap(page);
 		bprm->argc--;
 	}
 }

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)