diff options
author | Richard Braun <rbraun@sceen.net> | 2013-10-18 01:16:08 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2013-10-18 01:16:08 +0200 |
commit | 2e5f5e3c6d3716aec736474a198de5f7746a5450 (patch) | |
tree | 4c232d53f56081267743fc855aa5bae5cd831d2c | |
parent | 5ab5d98fa515cd19a64e8d5868fcbae85eec9dc5 (diff) |
pflocal: fix port leak when receiving port rights
The socket_send and socket_recv routines can be used to transmit port
rights along data. Unfortunately, pflocal retains a copy of these rights
in the socket_recv RPC. These lingering references would in turn lead to
other leaks in servers waiting for a no-sender notification to clean
their resources. Since these copied rights aren't used at all by the
server, it is safe to simply move them to the recipient instead.
* pflocal/socket.c (S_socket_recv): Transmit port rights using
MACH_MSG_TYPE_MOVE_SEND transfer type instead of MACH_MSG_TYPE_COPY_SEND.
-rw-r--r-- | pflocal/socket.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/pflocal/socket.c b/pflocal/socket.c index 6723734c..c5c97352 100644 --- a/pflocal/socket.c +++ b/pflocal/socket.c @@ -401,7 +401,7 @@ S_socket_recv (struct sock_user *user, /* Setup mach ports for return. */ { *addr_type = MACH_MSG_TYPE_MAKE_SEND; - *ports_type = MACH_MSG_TYPE_COPY_SEND; + *ports_type = MACH_MSG_TYPE_MOVE_SEND; if (source_addr) { *addr = ports_get_right (source_addr); |