path: root/src/sgsn/gprs_gmm.c
diff options
authorPau Espin Pedrol <pespin@sysmocom.de>2020-10-23 13:25:10 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-10-23 13:25:13 +0200
commit08395b3369a085250a2179837ab98379753c3b6e (patch)
tree0faaeab5c25284ae9919ce0a66328cd555445d34 /src/sgsn/gprs_gmm.c
parent25998ddcc56ff8c11bf7d2e19e672e3f1d4f034f (diff)
process_ms_ctx_status: Fix crash deleting PDP Ctx if GTP side was already released
sgsn_delete_pdp_ctx() should never be called without checking if the GTP side is available, since it may happen that it has already been released by the time the mmctx tells us the pdp ctx is gone on the MS side. Fixes: OS#4817 Change-Id: Ie618874545172ec98355174a2ee041fc4a8bec16
Diffstat (limited to 'src/sgsn/gprs_gmm.c')
1 files changed, 4 insertions, 1 deletions
diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c
index 0ad60037..3f7c8ab7 100644
--- a/src/sgsn/gprs_gmm.c
+++ b/src/sgsn/gprs_gmm.c
@@ -1533,7 +1533,10 @@ static void process_ms_ctx_status(struct sgsn_mm_ctx *mmctx,
LOGMMCTXP(LOGL_NOTICE, mmctx, "Dropping PDP context for NSAPI=%u "
"due to PDP CTX STATUS IE=0x%02x%02x\n",
pdp->nsapi, pdp_status[1], pdp_status[0]);
- sgsn_delete_pdp_ctx(pdp);
+ if (pdp->ggsn)
+ sgsn_delete_pdp_ctx(pdp);
+ else /* GTP side already detached, freeing */
+ sgsn_pdp_ctx_free(pdp);