summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2012-07-04 21:53:12 +0200
committerHarald Welte <laforge@gnumonks.org>2012-07-13 14:24:27 +0200
commitdafdfb5700f5b82bb12d1b3a6f168540ccefb2ec (patch)
tree9aa7006f0534b5cce8873c27ac234646563953cd
parentfdca6704dedace311878e5d52ae50c42c94a5166 (diff)
GPRS LLC: fix segfault when transmitting downlink unit-data without mmctx
-rw-r--r--openbsc/src/gprs/gprs_llc.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/openbsc/src/gprs/gprs_llc.c b/openbsc/src/gprs/gprs_llc.c
index c705c87..6244d18 100644
--- a/openbsc/src/gprs/gprs_llc.c
+++ b/openbsc/src/gprs/gprs_llc.c
@@ -43,11 +43,16 @@ static int _bssgp_tx_dl_ud(struct msgb *msg, struct sgsn_mm_ctx *mmctx)
struct bssgp_dl_ud_par dup;
const uint8_t qos_profile_default[3] = { 0x00, 0x00, 0x20 };
- dup.tlli = NULL;
- dup.imsi = mmctx->imsi;
- dup.drx_parms = mmctx->drx_parms;
- dup.ms_ra_cap.len = mmctx->ms_radio_access_capa.len;
- dup.ms_ra_cap.v = mmctx->ms_radio_access_capa.buf;
+ memset(&dup, 0, sizeof(dup));
+ /* before we have received some identity from the MS, we might
+ * not yet have a MMC context (e.g. XID negotiation of primarly
+ * LLC connection fro GMM sapi). */
+ if (mmctx) {
+ dup.imsi = mmctx->imsi;
+ dup.drx_parms = mmctx->drx_parms;
+ dup.ms_ra_cap.len = mmctx->ms_radio_access_capa.len;
+ dup.ms_ra_cap.v = mmctx->ms_radio_access_capa.buf;
+ }
memcpy(&dup.qos_profile, qos_profile_default,
sizeof(qos_profile_default));