From d717c7b27e1cd0b89c9557841c81f283494c1c08 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Fri, 7 Apr 2017 19:21:35 +0200 Subject: osmo_ss7: Fix segfault when routing MTP-TRANSFER.req to ASP without sctp connection Change-Id: I142a11b09672864b54b927b8334b1975c8cd6022 --- src/osmo_ss7.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/osmo_ss7.c b/src/osmo_ss7.c index 8ec099a..f7f2519 100644 --- a/src/osmo_ss7.c +++ b/src/osmo_ss7.c @@ -1376,10 +1376,21 @@ int osmo_ss7_asp_send(struct osmo_ss7_asp *asp, struct msgb *msg) OSMO_ASSERT(0); } - if (asp->cfg.is_server) + if (asp->cfg.is_server) { + if (!asp->server) { + LOGPASP(asp, DLSS7, LOGL_ERROR, "Cannot transmit, no asp->server\n"); + /* FIXME: what to do here? delete the route? send DUNA? */ + return -EIO; + } osmo_stream_srv_send(asp->server, msg); - else + } else { + if (!asp->client) { + LOGPASP(asp, DLSS7, LOGL_ERROR, "Cannot transmit, no asp->client\n"); + /* FIXME: what to do here? delete the route? send DUNA? */ + return -EIO; + } osmo_stream_cli_send(asp->client, msg); + } return 0; } -- cgit v1.2.3