From 4372ffe801330a8ed191ca252269fbd6c64a3d0e Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Thu, 5 Feb 2004 22:56:11 +0000 Subject: 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@ --- sys/kern/kern_exec.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sys/kern/kern_exec.c') 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); } -- cgit v1.2.3