summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debian/changelog2
-rw-r--r--debian/patches/magic_port_leak.patch71
2 files changed, 73 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog
index d1f645c7..5201d4d4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -11,6 +11,8 @@ hurd (20050513-3+SVN) unreleased; urgency=low
* debian/hurd.postinst: Removed creation of user `login'.
* debian/NEWS: Mention the possibility of starting the Hurd console
on bootup.
+ * debian/patches/magic_port_leak.patch: New patch by Marcus
+ Brinkmann, taken from CVS.
-- Michael Banck <mbanck@debian.org> Sun, 12 Jun 2005 23:53:59 +0200
diff --git a/debian/patches/magic_port_leak.patch b/debian/patches/magic_port_leak.patch
new file mode 100644
index 00000000..66403bc9
--- /dev/null
+++ b/debian/patches/magic_port_leak.patch
@@ -0,0 +1,71 @@
+2005-07-12 Marcus Brinkmann <marcus@gnu.org>
+
+ * magic.c (magic_getroot): Deallocate DOTDOT if processing here.
+ (magic_open): Do not allocate and deallocate DOTDOT, just consume
+ the reference given to us.
+ (magic_peropen_destroy): New function.
+ (main): If in directory mode, install magic_peropen_destroy hook.
+
+Index: trans/magic.c
+===================================================================
+RCS file: /cvsroot/hurd/hurd/trans/magic.c,v
+retrieving revision 1.17
+retrieving revision 1.18
+diff -u -r1.17 -r1.18
+--- hurd/trans/magic.c 6 Mar 2003 02:24:53 -0000 1.17
++++ hurd/trans/magic.c 12 Jul 2005 15:25:49 -0000 1.18
+@@ -150,6 +150,7 @@
+ retry_type *do_retry, char *retry_name,
+ mach_port_t *node, mach_msg_type_name_t *node_type)
+ {
++ error_t err;
+ struct magic *const m = cntl->hook;
+
+ if (m->directory)
+@@ -159,6 +160,10 @@
+ *do_retry = FS_RETRY_MAGICAL;
+ *node = MACH_PORT_NULL;
+ *node_type = MACH_MSG_TYPE_COPY_SEND;
++
++ err = mach_port_deallocate (mach_task_self (), dotdot);
++ assert_perror (err);
++
+ return 0;
+ }
+
+@@ -178,18 +183,21 @@
+ error_t err = trivfs_open (cntl, user, flags, realnode, cred);
+ if (!err)
+ {
++ /* We consume the reference for DOTDOT. */
+ (*cred)->po->hook = (void *) dotdot;
+- err = mach_port_mod_refs (mach_task_self (), dotdot,
+- MACH_PORT_RIGHT_SEND, +1);
+- assert_perror (err);
+- err = mach_port_deallocate (mach_task_self (), dotdot);
+- assert_perror (err);
+ struct magic *const m = cntl->hook;
+ m->nusers++;
+ }
+ return err;
+ }
+
++static void
++magic_peropen_destroy (struct trivfs_peropen *po)
++{
++ mach_port_deallocate (mach_task_self (), (mach_port_t) po->hook);
++}
++
++
+ /* We have this hook only for simple tracking of the live user ports. */
+ static void
+ magic_protid_destroy (struct trivfs_protid *cred)
+@@ -467,6 +475,8 @@
+ trivfs_getroot_hook = &magic_getroot;
+ trivfs_open_hook = &magic_open;
+ trivfs_protid_destroy_hook = &magic_protid_destroy;
++ if (m->directory)
++ trivfs_peropen_destroy_hook = &magic_peropen_destroy;
+
+ /* Reply to our parent */
+ err = trivfs_startup (bootstrap, 0, 0, 0, 0, 0, &fsys);