aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2018-09-18 16:53:42 +0200
committerAlexander Couzens <lynxis@fe80.eu>2018-09-18 16:56:29 +0200
commit53c326c9c845c5f77e6ba47cdcc189dd4fb8e1db (patch)
tree3f9af3b9f5efa799cf104887960684ac17c2043a
parent4782e1e9241202af5e218d1670cf1a7b68e9799f (diff)
sgsn_ggsn_ctx_drop_pdp: protect against nullpointer when MM is gone
When the GGSN crashs, the SGSN will be notified after it comes back. Because of the async operation, the mm ctx could be already gone. Change-Id: I507a8c2193c84f8dff7f5d669adcd3583331f289
-rw-r--r--src/gprs/gprs_sgsn.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gprs/gprs_sgsn.c b/src/gprs/gprs_sgsn.c
index 977ae489..dc0e7c07 100644
--- a/src/gprs/gprs_sgsn.c
+++ b/src/gprs/gprs_sgsn.c
@@ -707,7 +707,9 @@ failed:
void sgsn_ggsn_ctx_drop_pdp(struct sgsn_pdp_ctx *pctx)
{
- if (pctx->mm->gmm_state == GMM_REGISTERED_NORMAL) {
+ /* the MM context can be deleted while the GGSN is not reachable or
+ * if has been crashed. */
+ if (pctx->mm && pctx->mm->gmm_state == GMM_REGISTERED_NORMAL) {
gsm48_tx_gsm_deact_pdp_req(pctx, GSM_CAUSE_NET_FAIL, true);
sgsn_ggsn_ctx_remove_pdp(pctx->ggsn, pctx);
} else {