pespin has uploaded this change for review. (
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40193?usp=email )
Change subject: asp: Make sure asp->{client,server} is nulled before destroy callback
......................................................................
asp: Make sure asp->{client,server} is nulled before destroy callback
disconnect_cb() in case of stream_cli and closed_cb() in case of
stream_srv may call some libosmo-sigtran code. Make sure we don't access
the pointer anymore in that case for safety.
Change-Id: I3f0774eac630c8bc7e9a10f874e1c72763fd14a0
---
M src/osmo_ss7_asp.c
1 file changed, 7 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-sigtran refs/changes/93/40193/1
diff --git a/src/osmo_ss7_asp.c b/src/osmo_ss7_asp.c
index c054369..4044003 100644
--- a/src/osmo_ss7_asp.c
+++ b/src/osmo_ss7_asp.c
@@ -686,22 +686,27 @@
* announce disconnection to upper layers. */
int ss7_asp_disconnect_stream(struct osmo_ss7_asp *asp)
{
+ struct osmo_stream_cli *cli;
+ struct osmo_stream_srv *srv;
+
/* First tear down previous state if existing: */
if (asp->cfg.is_server) {
/* We are in server mode now */
if (asp->client) {
/* if we previously were in client mode,
* destroy it */
- osmo_stream_cli_destroy(asp->client);
+ cli = asp->client;
asp->client = NULL;
+ osmo_stream_cli_destroy(cli);
}
} else {
/* We are in client mode now */
if (asp->server) {
/* if we previously were in server mode,
* destroy it */
- osmo_stream_srv_destroy(asp->server);
+ srv = asp->server;
asp->server = NULL;
+ osmo_stream_srv_destroy(srv);
}
if (asp->client) {
/* Make sure we close the previous stream before starting a new one: */
--
To view, visit
https://gerrit.osmocom.org/c/libosmo-sigtran/+/40193?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: libosmo-sigtran
Gerrit-Branch: master
Gerrit-Change-Id: I3f0774eac630c8bc7e9a10f874e1c72763fd14a0
Gerrit-Change-Number: 40193
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>