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.
This commit is contained in:
Holger Hans Peter Freyther
2010-04-06 17:43:12 +02:00
parent 6949db1bd8
commit 33b0bee457

View File

@@ -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)