summaryrefslogtreecommitdiff
path: root/init
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2009-12-20 15:28:17 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2009-12-20 15:28:17 +0100
commit8451b436124bd7fdf9c907ebb24687dec10e12bf (patch)
treec865386f1d6104c45f7bd8ed63c7978703f4be00 /init
parent913d709e15209b2c33fdf146b4ad9d59737ab6a3 (diff)
Fix port leak when directly calling MIG stubs
* auth/auth.c (S_auth_server_authenticate): Check result of auth_server_authenticate_reply stub. * init/init.c (S_msg_sig_post_untraced): Check result of msg_sig_post_untraced_reply (S_msg_sig_post): Check result of msg_sig_post_reply.
Diffstat (limited to 'init')
-rw-r--r--init/init.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/init/init.c b/init/init.c
index d66bee0b..46457293 100644
--- a/init/init.c
+++ b/init/init.c
@@ -1353,12 +1353,16 @@ S_msg_sig_post_untraced (mach_port_t msgport,
mach_port_t reply, mach_msg_type_name_t reply_type,
int signo, natural_t sigcode, mach_port_t refport)
{
+ kern_return_t err;
+
if (refport != mach_task_self ())
return EPERM;
mach_port_deallocate (mach_task_self (), refport);
/* Reply immediately */
- msg_sig_post_untraced_reply (reply, reply_type, 0);
+ err = msg_sig_post_untraced_reply (reply, reply_type, 0);
+ if (err)
+ return err;
process_signal (signo);
return MIG_NO_REPLY;
@@ -1369,12 +1373,16 @@ S_msg_sig_post (mach_port_t msgport,
mach_port_t reply, mach_msg_type_name_t reply_type,
int signo, natural_t sigcode, mach_port_t refport)
{
+ kern_return_t err;
+
if (refport != mach_task_self ())
return EPERM;
mach_port_deallocate (mach_task_self (), refport);
/* Reply immediately */
- msg_sig_post_reply (reply, reply_type, 0);
+ err = msg_sig_post_reply (reply, reply_type, 0);
+ if (err)
+ return err;
process_signal (signo);
return MIG_NO_REPLY;