Change in osmo-bsc[master]: Lb: stop RESET FSM when sccp_user is unbound

neels gerrit-no-reply at lists.osmocom.org
Tue Apr 27 23:29:55 UTC 2021


neels has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/23912 )

Change subject: Lb: stop RESET FSM when sccp_user is unbound
......................................................................

Lb: stop RESET FSM when sccp_user is unbound

A crash was reported in bssmap_le_tx_reset() sending a RESET with
sccp_user == NULL. Looking at the issue I noticed that when the
sccp_user is torn down, the RESET FSM should also be terminated.

Add bssmap_reset_term_and_free() to the generic RESET FSM implementation
and call from lb_stop() before sccp_user is set to NULL.

Related: OS#5134
Change-Id: If412ef990fcdde8ff88098a5169e86f05cd1c7f0
---
M include/osmocom/bsc/bssmap_reset.h
M src/osmo-bsc/bssmap_reset.c
M src/osmo-bsc/lb.c
M tests/handover/handover_test.c
4 files changed, 17 insertions(+), 0 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/bssmap_reset.h b/include/osmocom/bsc/bssmap_reset.h
index 560c543..f90f5ec 100644
--- a/include/osmocom/bsc/bssmap_reset.h
+++ b/include/osmocom/bsc/bssmap_reset.h
@@ -27,3 +27,4 @@
 
 struct bssmap_reset *bssmap_reset_alloc(void *ctx, const char *label, const struct bssmap_reset_cfg *cfg);
 bool bssmap_reset_is_conn_ready(const struct bssmap_reset *bssmap_reset);
+void bssmap_reset_term_and_free(struct bssmap_reset *bssmap_reset);
diff --git a/src/osmo-bsc/bssmap_reset.c b/src/osmo-bsc/bssmap_reset.c
index fcf2bab..6c54560 100644
--- a/src/osmo-bsc/bssmap_reset.c
+++ b/src/osmo-bsc/bssmap_reset.c
@@ -70,6 +70,14 @@
 	return bssmap_reset;
 }
 
+void bssmap_reset_term_and_free(struct bssmap_reset *bssmap_reset)
+{
+	if (!bssmap_reset)
+		return;
+	osmo_fsm_inst_term(bssmap_reset->fi, OSMO_FSM_TERM_REQUEST, NULL);
+	talloc_free(bssmap_reset);
+}
+
 static void link_up(struct bssmap_reset *bssmap_reset)
 {
 	LOGPFSML(bssmap_reset->fi, LOGL_NOTICE, "link up\n");
diff --git a/src/osmo-bsc/lb.c b/src/osmo-bsc/lb.c
index be7d446..0ff7c5c 100644
--- a/src/osmo-bsc/lb.c
+++ b/src/osmo-bsc/lb.c
@@ -399,6 +399,12 @@
 	bsc_gsmnet->smlc->bssmap_reset = bssmap_reset_alloc(bsc_gsmnet, "Lb", &cfg);
 }
 
+static void lb_stop_reset_fsm()
+{
+	bssmap_reset_term_and_free(bsc_gsmnet->smlc->bssmap_reset);
+	bsc_gsmnet->smlc->bssmap_reset = NULL;
+}
+
 static int lb_start()
 {
 	uint32_t default_pc;
@@ -482,6 +488,7 @@
 	LOGP(DLCS, LOGL_INFO, "Shutting down Lb link\n");
 
 	lb_cancel_all();
+	lb_stop_reset_fsm();
 	osmo_sccp_user_unbind(bsc_gsmnet->smlc->sccp_user);
 	bsc_gsmnet->smlc->sccp_user = NULL;
 	return 0;
diff --git a/tests/handover/handover_test.c b/tests/handover/handover_test.c
index 917372b..d2b1757 100644
--- a/tests/handover/handover_test.c
+++ b/tests/handover/handover_test.c
@@ -1405,6 +1405,7 @@
 void osmo_bsc_sigtran_reset(void) {}
 void bssmap_reset_alloc(void) {}
 void bssmap_reset_is_conn_ready(void) {}
+void bssmap_reset_term_and_free(void) {}
 const char *osmo_mgcpc_ep_name(const struct osmo_mgcpc_ep *ep)
 {
 	return "fake-ep";

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23912
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: If412ef990fcdde8ff88098a5169e86f05cd1c7f0
Gerrit-Change-Number: 23912
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210427/8166c291/attachment.htm>


More information about the gerrit-log mailing list