aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-10-28 15:08:48 +0200
committerlaforge <laforge@osmocom.org>2021-10-29 05:48:43 +0000
commit298f6bff8697ca6857664d14c446cd53826453e8 (patch)
tree66924a1c1232ad6ff80c3428d6698f5e446c9a15
parent2537ddd23c7316896b0aad2396ffab2bf6a8d44c (diff)
bsc_subscr_conn_fsm: fix mgw-pool ref counting
When the gsm_subscr_conn_fsm (GSCO) terminates abormally it might not go through the forget-mgw-endpoint mechanism. It might be terminated forcefully, which means only the pre_term callback runs. The pre_term callback clears the endpoint, but it does not put the mgcp_client reference back into the pool. This results into a wrong ref-count in the mgw-pool. Change-Id: I5a7ce6a1880a1060df74d03dd4eb38b51fd85c69 Related: SYS#5675
-rw-r--r--src/osmo-bsc/bsc_subscr_conn_fsm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 1e61d3f78..c18079f34 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -955,8 +955,14 @@ static void gscon_cleanup(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cau
static void gscon_pre_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause cause)
{
struct gsm_subscriber_connection *conn = fi->priv;
+ struct mgcp_client *mgcp_client;
+
+ /* Put MGCP client back into MGW pool */
+ mgcp_client = osmo_mgcpc_ep_client(conn->user_plane.mgw_endpoint);
+ mgcp_client_pool_put(mgcp_client);
osmo_mgcpc_ep_clear(conn->user_plane.mgw_endpoint);
+ conn->user_plane.mgw_endpoint = NULL;
if (conn->lcls.fi) {
/* request termination of LCLS FSM */