aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-04-06 17:43:12 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2010-04-06 17:44:39 +0200
commit33b0bee457d335266f91e4c2876639c5f6f97940 (patch)
treebb5cd22616790bb20edb9409a4e4bc1fe9700868
parent6949db1bd877c84b6c1bef586823b3cf922414e3 (diff)
bsc_msc_ip.c: Crash fix when the MSC disconnects
Check if we do have the msc_data before invoking code in bssap.c. We might have lost the MSC connection and asked for the channel to be taken down but we might have received one last message from the BTS.
-rw-r--r--openbsc/src/bsc_msc_ip.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/openbsc/src/bsc_msc_ip.c b/openbsc/src/bsc_msc_ip.c
index 5976a0292..9412627a2 100644
--- a/openbsc/src/bsc_msc_ip.c
+++ b/openbsc/src/bsc_msc_ip.c
@@ -297,6 +297,11 @@ static int handle_cipher_m_complete(struct msgb *msg)
{
struct msgb *resp;
+ if (!msg->lchan->msc_data) {
+ LOGP(DMSC, LOGL_ERROR, "No MSC data for CIPHER MODE COMPLETE.\n");
+ return -1;
+ }
+
DEBUGP(DMSC, "CIPHER MODE COMPLETE from MS, forwarding to MSC\n");
resp = bssmap_create_cipher_complete(msg);
if (!resp) {
@@ -320,7 +325,7 @@ static int handle_ass_compl(struct msgb *msg)
DEBUGP(DMSC, "ASSIGNMENT COMPLETE from MS, forwarding to MSC\n");
if (!msg->lchan->msc_data) {
- DEBUGP(DMSC, "No MSC data\n");
+ LOGP(DMSC, LOGL_ERROR, "No MSC data\n");
put_lchan(msg->lchan, 0);
return -1;
}
@@ -367,7 +372,7 @@ static int handle_ass_fail(struct msgb *msg)
DEBUGP(DMSC, "ASSIGNMENT FAILURE from MS, forwarding to MSC\n");
if (!msg->lchan->msc_data) {
- DEBUGP(DMSC, "No MSC data\n");
+ LOGP(DMSC, LOGL_ERROR, "No MSC data\n");
put_lchan(msg->lchan, 0);
return -1;
}
@@ -398,6 +403,11 @@ static int handle_modify_ack(struct msgb *msg)
{
int rc;
+ if (!msg->lchan->msc_data) {
+ LOGP(DMSC, LOGL_ERROR, "No MSC data for modify ack.\n");
+ return -1;
+ }
+
/* modify RSL */
rc = gsm48_rx_rr_modif_ack(msg);
if (rc < 0)