process: Correct handling of out of processes case
authorAlan Cox <alan@linux.intel.com>
Thu, 18 Dec 2014 23:17:04 +0000 (23:17 +0000)
committerAlan Cox <alan@linux.intel.com>
Thu, 18 Dec 2014 23:17:04 +0000 (23:17 +0000)
When the error handling was updated this path was broken. With this fixed
running out of memory/swap now correctly fails with ENOMEM

Kernel/process.c

index cdebd25..ff8f4e3 100644 (file)
@@ -271,8 +271,10 @@ ptptr ptab_alloc(void)
                if (pagemap_alloc(newp) == 0) {
                        newp->p_status = P_FORKING;
                        nproc++;
-               } else
+               } else {
                        udata.u_error = ENOMEM;
+                       newp = NULL;
+                }
        }
        irqrestore(irq);
        if (newp)