[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[hurd] 14/26: libdiskfs: fix removal of socket nodes
From: |
Samuel Thibault |
Subject: |
[hurd] 14/26: libdiskfs: fix removal of socket nodes |
Date: |
Sat, 02 Nov 2013 14:44:45 +0000 |
This is an automated email from the git hooks/post-receive script.
sthibault pushed a commit to branch upstream
in repository hurd.
commit 5ab5d98fa515cd19a64e8d5868fcbae85eec9dc5
Author: Richard Braun <address@hidden>
Date: Fri Oct 18 01:16:08 2013 +0200
libdiskfs: fix removal of socket nodes
When the file system supports ifsock shortcuts, a socket node can obtain
a right on a socket address. This reference is only lost if the address
is destroyed, through a dead-name notification. On the other hand,
pflocal keeps the address around until all references are dropped. This
leads to a situation where socket nodes, addresses, and their associated
sockets are leaked. To remedy the situation, make addresses get a light
reference on socket nodes, and properly deallocate it when the node is
destroyed, which will in turn make pflocal correctly remove the matching
address and socket.
* libdiskfs/ifsock.c (diskfs_S_ifsock_getsockaddr): Add a light reference
instead of a hard one.
* libdiskfs/node-nput.c (diskfs_nput): Deallocate right to socket address
when cleaning light references.
---
libdiskfs/ifsock.c | 2 +-
libdiskfs/node-nput.c | 6 ++++++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/libdiskfs/ifsock.c b/libdiskfs/ifsock.c
index 9199fdf..01a9b1e 100644
--- a/libdiskfs/ifsock.c
+++ b/libdiskfs/ifsock.c
@@ -121,7 +121,7 @@ diskfs_S_ifsock_getsockaddr (struct protid *cred,
if (old != MACH_PORT_NULL)
mach_port_deallocate (mach_task_self (), old);
np->sockaddr = sockaddr;
- diskfs_nref (np);
+ diskfs_nref_light (np);
}
}
diff --git a/libdiskfs/node-nput.c b/libdiskfs/node-nput.c
index 35f05b5..5043ad1 100644
--- a/libdiskfs/node-nput.c
+++ b/libdiskfs/node-nput.c
@@ -56,6 +56,12 @@ diskfs_nput (struct node *np)
np->references++;
pthread_spin_unlock (&diskfs_node_refcnt_lock);
+ if (np->sockaddr != MACH_PORT_NULL)
+ {
+ mach_port_deallocate (mach_task_self (), np->sockaddr);
+ np->sockaddr = MACH_PORT_NULL;
+ }
+
diskfs_try_dropping_softrefs (np);
/* But there's no value in looping forever in this
--
Alioth's /usr/local/bin/git-commit-notice on
/srv/git.debian.org/git/pkg-hurd/hurd.git
- [hurd] 11/26: console-client: replace function epilogue with console_exit, (continued)
- [hurd] 11/26: console-client: replace function epilogue with console_exit, Samuel Thibault, 2013/11/02
- [hurd] 24/26: Fix use after free, Samuel Thibault, 2013/11/02
- [hurd] 12/26: term: fix read on a closed PTY, Samuel Thibault, 2013/11/02
- [hurd] 23/26: libshouldbeinlibc: fix error handling in maptime_map, Samuel Thibault, 2013/11/02
- [hurd] 05/26: trans: rename a global variable, Samuel Thibault, 2013/11/02
- [hurd] 07/26: console-client: remove the pid file on clean exits, Samuel Thibault, 2013/11/02
- [hurd] 08/26: console-client: entitle console_exit with the noreturn attribute, Samuel Thibault, 2013/11/02
- [hurd] 06/26: libfshelp: properly free active translator entries, Samuel Thibault, 2013/11/02
- [hurd] 21/26: configure.ac: properly escape the test for X11/keysymdef.h, Samuel Thibault, 2013/11/02
- [hurd] 25/26: libports: fix error handling in _ports_create_port_internal, Samuel Thibault, 2013/11/02
- [hurd] 14/26: libdiskfs: fix removal of socket nodes,
Samuel Thibault <=
- [hurd] 22/26: exec: Remove the remaining BFD related bits, Samuel Thibault, 2013/11/02
- [hurd] 13/26: pflocal: fix destruction of explicitely bound sockets, Samuel Thibault, 2013/11/02
- [hurd] 20/26: Make boot script accept more fsck values, Samuel Thibault, 2013/11/02
- [hurd] 19/26: Add xenl to hurd.ti, Samuel Thibault, 2013/11/02
- [hurd] 18/26: Make CUD more usual, Samuel Thibault, 2013/11/02
- [hurd] 17/26: Make boot script reboot when fsck told so, Samuel Thibault, 2013/11/02
- [hurd] 15/26: pflocal: fix port leak when receiving port rights, Samuel Thibault, 2013/11/02
- [hurd] 16/26: pflocal: fix message flags on receive, Samuel Thibault, 2013/11/02