From 8451b436124bd7fdf9c907ebb24687dec10e12bf Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 20 Dec 2009 15:28:17 +0100 Subject: 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. --- auth/auth.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'auth') diff --git a/auth/auth.c b/auth/auth.c index 3c5fa861..fd7c018f 100644 --- a/auth/auth.c +++ b/auth/auth.c @@ -367,6 +367,7 @@ S_auth_server_authenticate (struct authhandle *serverauth, { struct pending *u; struct authhandle *user; + error_t err; if (! serverauth) return EOPNOTSUPP; @@ -399,7 +400,6 @@ S_auth_server_authenticate (struct authhandle *serverauth, /* No pending user RPC for this port. Create a pending server RPC record. */ struct pending s; - error_t err; err = hurd_ihash_add (&pending_servers, rendezvous, &s); if (! err) @@ -428,12 +428,16 @@ S_auth_server_authenticate (struct authhandle *serverauth, /* Extract the ids. We must use a separate reply stub so we can deref the user auth handle after the reply uses its contents. */ - auth_server_authenticate_reply (reply, reply_type, 0, - user->euids.ids, user->euids.num, - user->auids.ids, user->auids.num, - user->egids.ids, user->egids.num, - user->agids.ids, user->agids.num); + err = auth_server_authenticate_reply (reply, reply_type, 0, + user->euids.ids, user->euids.num, + user->auids.ids, user->auids.num, + user->egids.ids, user->egids.num, + user->agids.ids, user->agids.num); + ports_port_deref (user); + if (err) + return err; + mach_port_deallocate (mach_task_self (), rendezvous); return MIG_NO_REPLY; } -- cgit v1.2.3