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
This commit is contained in:
Jacob Erlbeck
2014-10-20 16:05:55 +02:00
committed by Holger Hans Peter Freyther
parent 19e990d6a7
commit ae20b4b31b

View File

@@ -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);