Neels Hofmeyr has uploaded this change for review. ( 
https://gerrit.osmocom.org/12450


Change subject: vlr: auth_fsm: make sure vsub->auth_fsm = NULL when it 
terminates
......................................................................

vlr: auth_fsm: make sure vsub->auth_fsm = NULL when it terminates

A patch not yet merged to master uncovered a cleanup bug: if the vlr_auth_fsm
terminates in error, the vlr_subscr->auth_fsm may not be reset to NULL even
though the FSM instance has been deallocated. Fix by a .cleanup callback.

The patch uncovering the bug is 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.

The error looks like:

    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

Unfortunately I am not sure whether we have saved logging leading up to this
error.

Change-Id: I3c528eed295be2ee673ea295804372f388a0dccd
---
M src/libvlr/vlr_auth_fsm.c
1 file changed, 7 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/50/12450/1

diff --git a/src/libvlr/vlr_auth_fsm.c b/src/libvlr/vlr_auth_fsm.c
index 8419696..ccf3660 100644
--- a/src/libvlr/vlr_auth_fsm.c
+++ b/src/libvlr/vlr_auth_fsm.c
@@ -240,9 +240,6 @@
 /* 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 @@

        /* 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 @@
        .allstate_action = NULL,
        .log_subsys = DVLR,
        .event_names = fsm_auth_event_names,
+       .cleanup = auth_fsm_cleanup,
 };

 /***********************************************************************

--
To view, visit https://gerrit.osmocom.org/12450
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3c528eed295be2ee673ea295804372f388a0dccd
Gerrit-Change-Number: 12450
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <[email protected]>

Reply via email to