Gert Doering has uploaded a new patch set (#2) to the change originally created
by Antonio Quartulli. ( https://gerrit.openvpn.net/c/openvpn/+/2032?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by Arne Schwabe
Change subject: multi: release the session-id hash reference on shutdown
......................................................................
multi: release the session-id hash reference on shutdown
multi_hash_sid_add() takes a reference on the multi_instance, but
multi_close_instance() only drops it via multi_hash_sid_remove() when
not shutting down. On shutdown hash_free() then frees the table without
releasing the reference, so every instance still connected when the
server stops is leaked (reported by LeakSanitizer, which also turns the
exit code into 1).
Remove the instance from the session-id hash regardless of shutdown.
Unlike the other tables handled in that block, this one holds a
reference.
Fixes: 66f8cdb9 ("Add lookup of multi session by session id")
Change-Id: I62d95dad21891351a16cd6be43063406a024acee
Signed-off-by: Antonio Quartulli <[email protected]>
Acked-by: Arne Schwabe <[email protected]>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/2032
Message-Id: <[email protected]>
URL:
https://www.mail-archive.com/[email protected]/msg40135.html
Signed-off-by: Gert Doering <[email protected]>
---
M src/openvpn/multi.c
1 file changed, 7 insertions(+), 6 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/32/2032/2
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index b69a209..0366c11 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -584,6 +584,13 @@
m->earliest_wakeup = NULL;
}
+ /* The sid hash holds a reference on the instance: drop it on
+ * instance close, otherwise the instance is never freed */
+ if (session_id_defined(&mi->sid_hashed_value))
+ {
+ multi_hash_sid_remove(m, &mi->sid_hashed_value);
+ }
+
if (!shutdown)
{
if (mi->did_real_hash)
@@ -605,12 +612,6 @@
}
#endif
-
- if (session_id_defined(&mi->sid_hashed_value))
- {
- multi_hash_sid_remove(m, &mi->sid_hashed_value);
- }
-
if (mi->context.c2.tls_multi->rx_peer_id != MAX_PEER_ID)
{
m->instances[mi->context.c2.tls_multi->rx_peer_id] = NULL;
--
To view, visit https://gerrit.openvpn.net/c/openvpn/+/2032?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I62d95dad21891351a16cd6be43063406a024acee
Gerrit-Change-Number: 2032
Gerrit-PatchSet: 2
Gerrit-Owner: Antonio Quartulli <[email protected]>
Gerrit-Reviewer: Arne Schwabe <[email protected]>
Gerrit-CC: Gert Doering <[email protected]>
Gerrit-CC: openvpn-devel <[email protected]>
_______________________________________________
Openvpn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openvpn-devel