[glibc] 01/01: hurd-i386/tg-poll_errors_fixes.diff: Fix port leak
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch sid
in repository glibc.
commit 8e8a064b720e0c186e3bea866acc552cbe3a092f
Author: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Sun Dec 4 21:08:50 2016 +0100
hurd-i386/tg-poll_errors_fixes.diff: Fix port leak
---
debian/changelog | 1 +
debian/patches/hurd-i386/tg-poll_errors_fixes.diff | 28 ++++++++++++----------
2 files changed, 16 insertions(+), 13 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index edee79f..feb6621 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,7 @@ glibc (2.24-8) UNRELEASED; urgency=medium
* hurd-i386/tg-libc_rwlock_recursive.diff: New patch to work around
fakeroot-tcp issue, see #845930.
* hurd-i386/cvs-hurd_signal.h_c++.diff: New patch to fix building gdb.
+ * hurd-i386/tg-poll_errors_fixes.diff: Fix port leak.
-- Aurelien Jarno <aurel32@debian.org> Fri, 25 Nov 2016 23:09:39 +0100
diff --git a/debian/patches/hurd-i386/tg-poll_errors_fixes.diff b/debian/patches/hurd-i386/tg-poll_errors_fixes.diff
index 6ab8648..7c6b093 100644
--- a/debian/patches/hurd-i386/tg-poll_errors_fixes.diff
+++ b/debian/patches/hurd-i386/tg-poll_errors_fixes.diff
@@ -30,11 +30,11 @@ case, or else POLLERR.
---
- hurd/hurdselect.c | 147 +++++++++++++++++++++++++++++++++++++++---------------
- 1 file changed, 106 insertions(+), 41 deletions(-)
+ hurd/hurdselect.c | 149 +++++++++++++++++++++++++++++++++++++++---------------
+ 1 file changed, 108 insertions(+), 41 deletions(-)
diff --git a/hurd/hurdselect.c b/hurd/hurdselect.c
-index d453042..070ac1a 100644
+index 70780dd..dcda71b 100644
--- a/hurd/hurdselect.c
+++ b/hurd/hurdselect.c
@@ -34,6 +34,7 @@
@@ -162,16 +162,18 @@ index d453042..070ac1a 100644
}
-@@ -260,7 +288,7 @@ _hurd_select (int nfds,
+@@ -260,7 +288,9 @@ _hurd_select (int nfds,
portset = MACH_PORT_NULL;
for (i = firstfd; i <= lastfd; ++i)
- if (d[i].type)
-+ if (d[i].type & ~SELECT_ERROR)
++ if (!(d[i].type & ~SELECT_ERROR))
++ d[i].reply_port = MACH_PORT_NULL;
++ else
{
int type = d[i].type;
d[i].reply_port = __mach_reply_port ();
-@@ -294,11 +322,10 @@ _hurd_select (int nfds,
+@@ -294,11 +324,10 @@ _hurd_select (int nfds,
}
else
{
@@ -187,7 +189,7 @@ index d453042..070ac1a 100644
++got;
}
_hurd_port_free (&d[i].cell->port, &d[i].ulink, d[i].io_port);
-@@ -404,9 +431,10 @@ _hurd_select (int nfds,
+@@ -404,9 +433,10 @@ _hurd_select (int nfds,
#endif
msg.head.msgh_size != sizeof msg.success)
{
@@ -200,7 +202,7 @@ index d453042..070ac1a 100644
}
/* Look up the respondent's reply port and record its
-@@ -418,9 +446,18 @@ _hurd_select (int nfds,
+@@ -418,9 +448,18 @@ _hurd_select (int nfds,
if (d[i].type
&& d[i].reply_port == msg.head.msgh_local_port)
{
@@ -222,16 +224,16 @@ index d453042..070ac1a 100644
d[i].type |= SELECT_RETURNED;
++got;
-@@ -458,7 +495,7 @@ _hurd_select (int nfds,
+@@ -454,7 +493,7 @@ _hurd_select (int nfds,
if (firstfd != -1)
for (i = firstfd; i <= lastfd; ++i)
- if (d[i].type)
-+ if (d[i].type & ~(SELECT_ERROR | SELECT_RETURNED))
++ if (d[i].reply_port != MACH_PORT_NULL)
__mach_port_destroy (__mach_task_self (), d[i].reply_port);
if (firstfd == -1 || (firstfd != lastfd && portset != MACH_PORT_NULL))
/* Destroy PORTSET, but only if it's not actually the reply port for a
-@@ -480,15 +517,29 @@ _hurd_select (int nfds,
+@@ -476,15 +515,29 @@ _hurd_select (int nfds,
int type = d[i].type;
int_fast16_t revents = 0;
@@ -270,7 +272,7 @@ index d453042..070ac1a 100644
pollfds[i].revents = revents;
}
-@@ -508,6 +559,20 @@ _hurd_select (int nfds,
+@@ -504,6 +557,20 @@ _hurd_select (int nfds,
if ((type & SELECT_RETURNED) == 0)
type = 0;
@@ -292,4 +294,4 @@ index d453042..070ac1a 100644
ready++;
else if (readfds)
--
-tg: (ca390b5..) t/poll_errors_fixes (depends on: t/io_select_timeout)
+tg: (de946c7..) t/poll_errors_fixes (depends on: t/io_select_timeout)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-glibc/glibc.git
Reply to: