summaryrefslogtreecommitdiff
path: root/Kernel/Net/LocalSocket.h
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2021-09-16 00:10:03 +0000
committerAndreas Kling <kling@serenityos.org>2021-09-16 16:50:36 +0200
commit220b7dd77905b7d573ded093cf88d2dc51f57c69 (patch)
tree35ff8b15abeab295dc2b22cdf198332c14191bbe /Kernel/Net/LocalSocket.h
parent0ccef94a496300becc4dd6e5a2bde3c7fe12dc68 (diff)
downloadserenity-220b7dd77905b7d573ded093cf88d2dc51f57c69.zip
Kernel: Weakly hold on to the file in LocalSocket
Because we were holding a strong ref to the OpenFileDescription in LocalSocket and a strong ref to the LocalSocket in Inode, we were creating a reference cycle in the event of the socket being cleaned up after the file description did (i.e. unlinking the file before closing the socket), because the file description never got destructed.
Diffstat (limited to 'Kernel/Net/LocalSocket.h')
-rw-r--r--Kernel/Net/LocalSocket.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/LocalSocket.h b/Kernel/Net/LocalSocket.h
index f1327944e0..00e8a4b4ff 100644
--- a/Kernel/Net/LocalSocket.h
+++ b/Kernel/Net/LocalSocket.h
@@ -71,8 +71,8 @@ private:
KResult try_set_path(StringView);
- // An open socket file on the filesystem.
- RefPtr<OpenFileDescription> m_file;
+ // The inode this socket is bound to.
+ WeakPtr<Inode> m_inode;
UserID m_prebind_uid { 0 };
GroupID m_prebind_gid { 0 };