diff options
author | 2012-11-19 09:26:08 +0000 | |
---|---|---|
committer | 2012-11-19 09:26:08 +0000 | |
commit | 6293fd657db08e02b8f8d0fea9567f487a7fbc59 (patch) | |
tree | 27e47ab9530d1a7b91af2f2cf0921b33ad498dab /sys/kern/kern_fork.c | |
parent | sync usage(), and tidy up the output a little; ok schwarze (diff) | |
download | wireguard-openbsd-6293fd657db08e02b8f8d0fea9567f487a7fbc59.tar.xz wireguard-openbsd-6293fd657db08e02b8f8d0fea9567f487a7fbc59.zip |
If uvm_km_kmemalloc_pla() fails when just creating a thread (and not a
process), then don't decrement the total and per-user counts of processes.
ok deraadt@ miod@
Diffstat (limited to 'sys/kern/kern_fork.c')
-rw-r--r-- | sys/kern/kern_fork.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/kern_fork.c b/sys/kern/kern_fork.c index 498b52605cf..4f3e7fbacf6 100644 --- a/sys/kern/kern_fork.c +++ b/sys/kern/kern_fork.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_fork.c,v 1.142 2012/08/02 03:18:48 guenther Exp $ */ +/* $OpenBSD: kern_fork.c,v 1.143 2012/11/19 09:26:08 guenther Exp $ */ /* $NetBSD: kern_fork.c,v 1.29 1996/02/09 18:59:34 christos Exp $ */ /* @@ -302,8 +302,10 @@ fork1(struct proc *curp, int exitsig, int flags, void *stack, pid_t *tidptr, no_constraint.ucr_low, no_constraint.ucr_high, 0, 0, USPACE/PAGE_SIZE); if (uaddr == 0) { - chgproccnt(uid, -1); - nprocesses--; + if ((flags & FORK_THREAD) == 0) { + (void)chgproccnt(uid, -1); + nprocesses--; + } nthreads--; return (ENOMEM); } |