[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/11] init: fix port leak
From: |
Justus Winter |
Subject: |
[PATCH 02/11] init: fix port leak |
Date: |
Wed, 27 Nov 2013 13:31:09 +0100 |
* init/init.c (S_startup_essential_task): Fix port leak.
---
init/init.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/init/init.c b/init/init.c
index de5dd6b..b7b40bd 100644
--- a/init/init.c
+++ b/init/init.c
@@ -1202,6 +1202,10 @@ S_startup_essential_task (mach_port_t server,
static int authinit, procinit, execinit;
int fail;
+ /* Always deallocate the extra reference this message carries. */
+ if (MACH_PORT_VALID (credential))
+ mach_port_deallocate (mach_task_self (), credential);
+
if (credential != host_priv)
return EPERM;
@@ -1209,8 +1213,6 @@ S_startup_essential_task (mach_port_t server,
if (fail)
return fail;
- mach_port_deallocate (mach_task_self (), credential);
-
if (!booted)
{
if (!strcmp (name, "auth"))
--
1.7.10.4
- [PATCH 01/11] libshouldbeinlibc: fix minor port leak in maptime_map, Justus Winter, 2013/11/27
- [PATCH 03/11] proc: update comments, Justus Winter, 2013/11/27
- [PATCH 04/11] libports: improve error handling in ports_reallocate_port, Justus Winter, 2013/11/27
- [PATCH 02/11] init: fix port leak,
Justus Winter <=
- [PATCH 05/11] libports: improve error handling in ports_reallocate_from_external, Justus Winter, 2013/11/27
- [PATCH 06/11] libports: improve error handling in ports_transfer_right, Justus Winter, 2013/11/27
- [PATCH 07/11] libdiskfs: improve error reporting in diskfs_start_disk_pager, Justus Winter, 2013/11/27
- [PATCH 10/11] proc: store the privileged host port in _hurd_host_priv, Justus Winter, 2013/11/27
- [PATCH 09/11] libports: improve error reporting in adjust_priority, Justus Winter, 2013/11/27