summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2016-11-02 02:41:41 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2017-02-24 15:18:21 +0100
commitf30b66c5315392e6336803a04d92e6ca3b1e9e4e (patch)
tree95aaaee0ec39f4a70b44801b6840d9f56ac1d072
parented0bf2931f4c30d70cd5858348bf8d589b80a1a6 (diff)
abis_om2k: protect mo fsms by NULL check
also set them NULL Change-Id: I30df0b9ab8bc47ba9756c8388e977deed0e40200
-rw-r--r--openbsc/src/libbsc/abis_om2000.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/openbsc/src/libbsc/abis_om2000.c b/openbsc/src/libbsc/abis_om2000.c
index 8d4a277..55f35dd 100644
--- a/openbsc/src/libbsc/abis_om2000.c
+++ b/openbsc/src/libbsc/abis_om2000.c
@@ -1706,9 +1706,19 @@ static void om2k_mo_st_wait_opinfo_accept(struct osmo_fsm_inst *fi, uint32_t eve
static void om2k_mo_s_done_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
{
+ struct om2k_mo_fsm_priv *omfp = fi->priv;
+ omfp->mo->fsm = NULL;
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_REGULAR, NULL);
}
+static void om2k_mo_s_error_onenter(struct osmo_fsm_inst *fi, uint32_t prev_state)
+{
+ struct om2k_mo_fsm_priv *omfp = fi->priv;
+
+ omfp->mo->fsm = NULL;
+ osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
+}
+
static const struct osmo_fsm_state om2k_is_states[] = {
[OM2K_ST_INIT] = {
.name = "INIT",
@@ -1803,7 +1813,7 @@ static const struct osmo_fsm_state om2k_is_states[] = {
.name = "ERROR",
.in_event_mask = 0,
.out_state_mask = 0,
- .onenter = om2k_mo_s_done_onenter,
+ .onenter = om2k_mo_s_error_onenter,
},
};
@@ -2706,6 +2716,12 @@ int abis_om2k_rcvmsg(struct msgb *msg)
msgb_hexdump(msg));
return 0;
}
+ if (!mo->fsm) {
+ LOGP(DNM, LOGL_ERROR, "MO object should not generate any message. fsm == NULL "
+ "%s: %s\n", get_value_string(om2k_msgcode_vals, msg_type),
+ msgb_hexdump(msg));
+ return 0;
+ }
/* Dispatch message to that MO */
om2k_mo_fsm_recvmsg(bts, mo, &odm);