aboutsummaryrefslogtreecommitdiff
path: root/proc
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-21 13:19:46 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2022-12-21 13:24:50 +0100
commit18835e7576609524f3613709b579fc90b78bf24f (patch)
treec641861268338134208c3a4afd00250d72b268bb /proc
parent84f8c49f12bb228e73d80ab82dba2707d3253153 (diff)
downloadhurd-18835e7576609524f3613709b579fc90b78bf24f.tar.gz
hurd-18835e7576609524f3613709b579fc90b78bf24f.tar.bz2
hurd-18835e7576609524f3613709b579fc90b78bf24f.zip
proc: Do not deallocate input ports on error
The error handling code would already deallocate them, thus leading to duplicate deallocation, spurious destroy, and later on port mixup.
Diffstat (limited to 'proc')
-rw-r--r--proc/mgt.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/proc/mgt.c b/proc/mgt.c
index 2841d2d7..38a3a90c 100644
--- a/proc/mgt.c
+++ b/proc/mgt.c
@@ -690,10 +690,10 @@ S_proc_exception_raise (struct exc *e,
the faulting thread's state to run its recovery code, which should
dequeue that message. */
err = thread_set_state (thread, e->flavor, e->thread_state, e->statecnt);
- mach_port_deallocate (mach_task_self (), thread);
- mach_port_deallocate (mach_task_self (), task);
if (err)
return err;
+ mach_port_deallocate (mach_task_self (), thread);
+ mach_port_deallocate (mach_task_self (), task);
return MIG_NO_REPLY;
default:
@@ -1367,11 +1367,7 @@ S_mach_notify_new_task (struct port_info *notify,
parentp = task_find_nocreate (parent);
if (! parentp)
- {
- mach_port_deallocate (mach_task_self (), task);
- mach_port_deallocate (mach_task_self (), parent);
- return ESRCH;
- }
+ return ESRCH;
childp = task_find_nocreate (task);
if (! childp)
@@ -1411,10 +1407,7 @@ S_proc_make_task_namespace (struct proc *callerp,
return EINVAL;
if (MACH_PORT_VALID (callerp->p_task_namespace))
- {
- mach_port_deallocate (mach_task_self (), notify);
- return EBUSY;
- }
+ return EBUSY;
callerp->p_task_namespace = notify;