From ae20b4b31b679d7ea057f4db8427b99293068ec5 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 20 Oct 2014 16:05:55 +0200 Subject: sgsn: Cancel pending timer in sgsn_mm_ctx_free Currently the timer is not stopped before the MM context is freed which can lead to failure if sgsn_mm_ctx_free is called while timer protected procedures are active. This patch add code to cancel the timer if necessary from within sgsn_mm_ctx_free. Ticket: OW#1322 Sponsored-by: On-Waves ehf --- openbsc/src/gprs/gprs_sgsn.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'openbsc') diff --git a/openbsc/src/gprs/gprs_sgsn.c b/openbsc/src/gprs/gprs_sgsn.c index ce9868e19..e68471313 100644 --- a/openbsc/src/gprs/gprs_sgsn.c +++ b/openbsc/src/gprs/gprs_sgsn.c @@ -180,6 +180,11 @@ void sgsn_mm_ctx_free(struct sgsn_mm_ctx *mm) { struct sgsn_pdp_ctx *pdp, *pdp2; + if (osmo_timer_pending(&mm->timer)) { + LOGMMCTXP(LOGL_INFO, mm, "Cancelling MM timer %u\n", mm->T); + osmo_timer_del(&mm->timer); + } + /* Unlink from global list of MM contexts */ llist_del(&mm->list); -- cgit v1.2.3