From 5ab5d98fa515cd19a64e8d5868fcbae85eec9dc5 Mon Sep 17 00:00:00 2001 From: Richard Braun Date: Fri, 18 Oct 2013 01:16:08 +0200 Subject: 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 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libdiskfs/ifsock.c') diff --git a/libdiskfs/ifsock.c b/libdiskfs/ifsock.c index 9199fdf6..01a9b1ea 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); } } -- cgit v1.2.3