fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / arch / m68k / mm / fault.c
index 805284a..2adbeb1 100644 (file)
@@ -99,7 +99,7 @@ int do_page_fault(struct pt_regs *regs, unsigned long address,
         * If we're in an interrupt or have no user
         * context, we must not take the fault..
         */
-       if (in_interrupt() || !mm)
+       if (in_atomic() || !mm)
                goto no_context;
 
        down_read(&mm->mmap_sem);
@@ -144,7 +144,7 @@ good_area:
                case 1:         /* read, present */
                        goto acc_err;
                case 0:         /* read, not present */
-                       if (!(vma->vm_flags & (VM_READ | VM_EXEC)))
+                       if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE)))
                                goto acc_err;
        }
 
@@ -157,16 +157,16 @@ good_area:
  survive:
        fault = handle_mm_fault(mm, vma, address, write);
 #ifdef DEBUG
-       printk("handle_mm_fault returns %d\n",fault);
+       printk("handle_mm_fault returns %d\n",fault);
 #endif
        switch (fault) {
-       case 1:
+       case VM_FAULT_MINOR:
                current->min_flt++;
                break;
-       case 2:
+       case VM_FAULT_MAJOR:
                current->maj_flt++;
                break;
-       case 0:
+       case VM_FAULT_SIGBUS:
                goto bus_err;
        default:
                goto out_of_memory;
@@ -181,12 +181,12 @@ good_area:
  */
 out_of_memory:
        up_read(&mm->mmap_sem);
-       if (current->pid == 1) {
+       if (is_init(current)) {
                yield();
                down_read(&mm->mmap_sem);
                goto survive;
        }
-       
+
        printk("VM: killing process %s\n", current->comm);
        if (user_mode(regs))
                do_exit(SIGKILL);