From 08395b3369a085250a2179837ab98379753c3b6e Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 23 Oct 2020 13:25:10 +0200 Subject: 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 --- src/sgsn/gprs_gmm.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/sgsn/gprs_gmm.c b/src/sgsn/gprs_gmm.c index 0ad600376..3f7c8ab72 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); } } -- cgit v1.2.3