summaryrefslogtreecommitdiff
path: root/sys/kern/kern_exec.c
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2004-02-05 22:56:11 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2004-02-05 22:56:11 +0000
commit4372ffe801330a8ed191ca252269fbd6c64a3d0e (patch)
treedb926e4d52f1c7d318462c5fe2dd91b71855ea5e /sys/kern/kern_exec.c
parent8c02d26d5b1809a4406ad7ace649366b469967d5 (diff)
Decrement reference count in error case if uvm_map(9) fails and we
had previously increased the reference count. Should not happen, but... From dhartmei@; ok deraadt@
Diffstat (limited to 'sys/kern/kern_exec.c')
-rw-r--r--sys/kern/kern_exec.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index c8c4b2e14bb..68f856db795 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_exec.c,v 1.82 2003/09/01 18:06:03 henning Exp $ */
+/* $OpenBSD: kern_exec.c,v 1.83 2004/02/05 22:56:10 millert Exp $ */
/* $NetBSD: kern_exec.c,v 1.75 1996/02/09 18:59:28 christos Exp $ */
/*-
@@ -738,6 +738,7 @@ exec_sigcode_map(struct proc *p, struct emul *e)
0, 0, UVM_MAPFLAG(UVM_PROT_RW, UVM_PROT_RW,
UVM_INH_SHARE, UVM_ADV_RANDOM, 0)))) {
printf("kernel mapping failed %d\n", r);
+ uao_detach(e->e_sigobject);
return (ENOMEM);
}
memcpy((void *)va, e->e_sigcode, sz);
@@ -751,6 +752,7 @@ exec_sigcode_map(struct proc *p, struct emul *e)
e->e_sigobject, 0, 0, UVM_MAPFLAG(UVM_PROT_RX, UVM_PROT_RX,
UVM_INH_SHARE, UVM_ADV_RANDOM, 0))) {
printf("user mapping failed\n");
+ uao_detach(e->e_sigobject);
return (ENOMEM);
}