patch-2.1.106 linux/arch/i386/mm/fault.c

Next file: linux/arch/i386/mm/init.c
Previous file: linux/arch/i386/math-emu/fpu_entry.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.105/linux/arch/i386/mm/fault.c linux/arch/i386/mm/fault.c
@@ -102,11 +102,11 @@
 
 	if (local_irq_count[smp_processor_id()])
 		die_if_kernel("page fault from irq handler",regs,error_code);
-	lock_kernel();
 	tsk = current;
 	mm = tsk->mm;
 
 	down(&mm->mmap_sem);
+
 	vma = find_vma(mm, address);
 	if (!vma)
 		goto bad_area;
@@ -151,7 +151,7 @@
 				goto bad_area;
 	}
 	handle_mm_fault(tsk, vma, address, write);
-	up(&mm->mmap_sem);
+
 	/*
 	 * Did it hit the DOS screen memory VA from vm86 mode?
 	 */
@@ -160,7 +160,8 @@
 		if (bit < 32)
 			tsk->tss.screen_bitmap |= 1 << bit;
 	}
-	goto out;
+	up(&mm->mmap_sem);
+	return;
 
 /*
  * Something tried to access memory that isn't in our memory map..
@@ -175,7 +176,7 @@
 		tsk->tss.error_code = error_code;
 		tsk->tss.trap_no = 14;
 		force_sig(SIGSEGV, tsk);
-		goto out;
+		return;
 	}
 
 	/*
@@ -187,7 +188,6 @@
 		nr = (address - (unsigned long) idt) >> 3;
 
 		if (nr == 6) {
-			unlock_kernel();
 			do_invalid_op(regs, 0);
 			return;
 		}
@@ -196,7 +196,7 @@
 	/* Are we prepared to handle this kernel fault?  */
 	if ((fixup = search_exception_table(regs->eip)) != 0) {
 		regs->eip = fixup;
-		goto out;
+		return;
 	}
 
 /*
@@ -215,7 +215,7 @@
 		 * CPU state on certain buggy processors.
 		 */
 		printk("Ok");
-		goto out;
+		return;
 	}
 
 	if (address < PAGE_SIZE)
@@ -234,8 +234,8 @@
 		page = ((unsigned long *) __va(page))[address >> PAGE_SHIFT];
 		printk(KERN_ALERT "*pte = %08lx\n", page);
 	}
+	lock_kernel();
 	die_if_kernel("Oops", regs, error_code);
 	do_exit(SIGKILL);
-out:
 	unlock_kernel();
 }

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