summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Couzens <lynxis@fe80.eu>2016-11-02 02:41:41 +0100
committerAlexander Couzens <lynxis@fe80.eu>2016-11-02 02:41:41 +0100
commit83ab66e2f9434938bafec345e979f5c2e355a300 (patch)
tree0c0acde7e7b786882b13174436ca5c08b19c45cf
parent899b6cac9c3346cdac61ef5b7dd580ee4ba83327 (diff)
abis_om2k: protect mo fsms by NULL checklynxis/om2000-rebase
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 1ab77b192..437bd16c3 100644
--- a/openbsc/src/libbsc/abis_om2000.c
+++ b/openbsc/src/libbsc/abis_om2000.c
@@ -1643,9 +1643,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",
@@ -1740,7 +1750,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,
},
};
@@ -2619,6 +2629,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);