client: replace two assertions with graceful error handling
A user reports crashes of osmo-bsc upon EV_MDCX. It turns out that there is a lot of error reporting and a distinct possibility to get a NULL return value because of external input. Terminate the FSM instead. FSM termination is the proper way to report a bad error, it signals the parent_term_evt to the FSM parent, which will then be able to act on the failed MGCP operation. Related: SYS#6632 Change-Id: Ia5d8a9aff565399a85a5b116d7029fedcab234e0
This commit is contained in:
parent
8b663e4d7c
commit
0127a0608d
|
@ -364,13 +364,21 @@ static void fsm_ready_cb(struct osmo_fsm_inst *fi, uint32_t event, void *data)
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case EV_MDCX:
|
case EV_MDCX:
|
||||||
msg = make_mdcx_msg(mgcp_ctx);
|
msg = make_mdcx_msg(mgcp_ctx);
|
||||||
OSMO_ASSERT(msg);
|
if (!msg) {
|
||||||
|
/* make_mdcx_msg() should already have logged the error */
|
||||||
|
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
rc = mgcp_client_tx(mgcp, msg, mgw_mdcx_resp_cb, fi);
|
rc = mgcp_client_tx(mgcp, msg, mgw_mdcx_resp_cb, fi);
|
||||||
new_state = ST_MDCX_RESP;
|
new_state = ST_MDCX_RESP;
|
||||||
break;
|
break;
|
||||||
case EV_DLCX:
|
case EV_DLCX:
|
||||||
msg = make_dlcx_msg(mgcp_ctx);
|
msg = make_dlcx_msg(mgcp_ctx);
|
||||||
OSMO_ASSERT(msg);
|
if (!msg) {
|
||||||
|
/* make_dlcx_msg() should already have logged the error */
|
||||||
|
osmo_fsm_inst_term(fi, OSMO_FSM_TERM_ERROR, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
rc = mgcp_client_tx(mgcp, msg, mgw_dlcx_resp_cb, fi);
|
rc = mgcp_client_tx(mgcp, msg, mgw_dlcx_resp_cb, fi);
|
||||||
new_state = ST_DLCX_RESP;
|
new_state = ST_DLCX_RESP;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue