aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2010-12-27 10:55:45 +0100
committerHarald Welte <laforge@gnumonks.org>2010-12-27 10:59:27 +0100
commit4a332e3282a680eae381bd5766a52731032819a0 (patch)
tree703c46bbed47e52edec6b37cc5ec9f4c8d06ccc8 /openbsc/src
parentc564022d887775b5f29586f8e4e8e75bf1c62eaf (diff)
bsc: Avoid crashing when no lchan is present in the subscriber connection
If someone wants to send a message but we have no lchan anymore we will now complain, delete the message and return.
Diffstat (limited to 'openbsc/src')
-rw-r--r--openbsc/src/bsc_api.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/openbsc/src/bsc_api.c b/openbsc/src/bsc_api.c
index 68a9de6dd..13c29aac2 100644
--- a/openbsc/src/bsc_api.c
+++ b/openbsc/src/bsc_api.c
@@ -262,7 +262,17 @@ int bsc_api_init(struct gsm_network *network, struct bsc_api *api)
int gsm0808_submit_dtap(struct gsm_subscriber_connection *conn,
struct msgb *msg, int link_id, int allow_sach)
{
- uint8_t sapi = link_id & 0x7;
+ uint8_t sapi;
+
+
+ if (!conn->lchan) {
+ LOGP(DMSC, LOGL_ERROR,
+ "Called submit dtap without an lchan.\n");
+ msgb_free(msg);
+ return -1;
+ }
+
+ sapi = link_id & 0x7;
msg->lchan = conn->lchan;
msg->trx = msg->lchan->ts->trx;