aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-12-28 00:20:20 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-12-28 21:23:53 +0100
commite5eb6d4ffd862b14858b28cc2b705c7c64836924 (patch)
tree6785c773395864e7ed18e138b11bae29dde455ed
parentc6e24b894b4657c0aabeaf31aa2207b78329a505 (diff)
vlr: auth_fsm: make sure vsub->auth_fsm = NULL when it terminates
Probably fixes this segfault: at ../../../../src/osmo-msc/src/libvlr/vlr_lu_fsm.c:957 file=file@entry=0x5611d8f10c28 "../../../../src/osmo-msc/src/libvlr/vlr_lu_fsm.c", line=line@entry=1467) at ../../../src/libosmocore/src/fsm.c:580 parent_event_failure=parent_event_failure@entry=6, parent_event_data=parent_event_data@entry=0x0, vlr=0x5611d98862b0, msc_conn_ref=msc_conn_ref@entry=0x5611d9aa8150, type=VLR_LU_TYPE_REGULAR, tmsi=4294967295, imsi=0x7ffd756c1cf0 "262423403004874", old_lai=0x7ffd756c1ce0, new_lai=0x7ffd756c1ce8, authentication_required=true, ciphering_required=true, is_r99=false, is_utran=false, assign_tmsi=true) at ../../../../src/osmo-msc/src/libvlr/vlr_lu_fsm.c:1467 at ../../../../src/osmo-msc/src/libmsc/gsm_04_08.c:443 The segfault is indirectly caused by 1fbf45c291f7e1f09ef2e862abfeca6a23efdc03, 'enrich context for vlr_subscr_name and ran_conn fi name', which sets auth_fsm context, on a non-NULL auth_fsm that has been deallocated. Change-Id: I3c528eed295be2ee673ea295804372f388a0dccd
-rw-r--r--src/libvlr/vlr_auth_fsm.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index 84196965e..ccf3660b8 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -240,9 +240,6 @@ static const char *vlr_auth_fsm_result_name(enum gsm48_reject_value result)
/* Terminate the Auth FSM Instance and notify parent */
static void auth_fsm_term(struct osmo_fsm_inst *fi, enum gsm48_reject_value result)
{
- struct auth_fsm_priv *afp = fi->priv;
- struct vlr_subscr *vsub = afp->vsub;
-
LOGPFSM(fi, "Authentication terminating with result %s\n",
vlr_auth_fsm_result_name(result));
@@ -254,6 +251,12 @@ static void auth_fsm_term(struct osmo_fsm_inst *fi, enum gsm48_reject_value resu
/* return the result to the parent FSM */
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_REGULAR, &result);
+}
+
+static void auth_fsm_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
+{
+ struct auth_fsm_priv *afp = fi->priv;
+ struct vlr_subscr *vsub = afp->vsub;
vsub->auth_fsm = NULL;
}
@@ -583,6 +586,7 @@ struct osmo_fsm vlr_auth_fsm = {
.allstate_action = NULL,
.log_subsys = DVLR,
.event_names = fsm_auth_event_names,
+ .cleanup = auth_fsm_cleanup,
};
/***********************************************************************