aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-10-31 12:27:11 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-11-14 09:26:27 +0100
commitb1c074f62c1d04138b751f71e3b07fbb0a521898 (patch)
tree4104c36013d2f34597bb00f3dcc8d7a26d38e60e
parentabdf02b9b988a816201b4530f36f709ca4c146ac (diff)
sgsn: Fix LLME leak when forcing a reattach
Currently when forceing a reattach by sending a Detach Request (reattach), the SGSN waits for the Detach Accept until it frees the MM context (if present) and the LLME. If that message gets lost or isn't sent by the MS, the LLME is never freed if it isn't bound to an MM context. This patch adds code to free the MM context/LLME when forcing a reattachment. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/gprs/gprs_gmm.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/openbsc/src/gprs/gprs_gmm.c b/openbsc/src/gprs/gprs_gmm.c
index 711981680..575ad7965 100644
--- a/openbsc/src/gprs/gprs_gmm.c
+++ b/openbsc/src/gprs/gprs_gmm.c
@@ -1153,7 +1153,12 @@ static int gsm0408_rcv_gmm(struct sgsn_mm_ctx *mmctx, struct msgb *msg,
}
/* Force the MS to re-attach */
- return sgsn_force_reattach_oldmsg(msg);
+ rc = sgsn_force_reattach_oldmsg(msg);
+
+ /* TLLI unassignment */
+ gprs_llgmm_assign(llme, llme->tlli, 0xffffffff,
+ GPRS_ALGO_GEA0, NULL);
+ return rc;
}
switch (gh->msg_type) {
@@ -1705,15 +1710,12 @@ int gsm0408_gprs_force_reattach(struct sgsn_mm_ctx *mmctx)
int rc;
gprs_llgmm_reset(mmctx->llme);
- /* Delete all existing PDP contexts for this MS */
- delete_pdp_contexts(mmctx, "forced reattach");
+ rc = gsm48_tx_gmm_detach_req(
+ mmctx, GPRS_DET_T_MT_REATT_REQ, GMM_CAUSE_IMPL_DETACHED);
- /* TODO:
- * properly start detach procedure (timeout, wait for ACK) and
- * do nothing if a re-attach is in progress */
+ mm_ctx_cleanup_free(mmctx, "forced reattach");
- return gsm48_tx_gmm_detach_req(
- mmctx, GPRS_DET_T_MT_REATT_REQ, GMM_CAUSE_IMPL_DETACHED);
+ return rc;
}
/* Main entry point for incoming 04.08 GPRS messages */