pespin has submitted this change. (
https://gerrit.osmocom.org/c/osmo-cbc/+/38978?usp=email )
Change subject: abis: Fix reusing link->conn while it is being destroyed
......................................................................
abis: Fix reusing link->conn while it is being destroyed
Call to osmo_stream_cli_destroy() may end up triggering disconnect_cb(),
and we don't want to attempt doing more stuff with that conn when that
happens (we were even trying to reconnect() it...).
Avoid it by marking the pointer as NULL immediatelly before calling
e1inp_sign_link_destroy().
Change-Id: I56605766af974d86610d0958f4b82e6e4ff94502
---
M src/cbsp_link.c
1 file changed, 5 insertions(+), 2 deletions(-)
Approvals:
osmith: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/cbsp_link.c b/src/cbsp_link.c
index 07fbadd..6b355df 100644
--- a/src/cbsp_link.c
+++ b/src/cbsp_link.c
@@ -102,6 +102,8 @@
static int cbc_cbsp_link_cli_disconnect_cb(struct osmo_stream_cli *conn)
{
struct cbc_cbsp_link *link = osmo_stream_cli_get_data(conn);
+ if (!link->conn) /* conn is being destroyed by us, we called
osmo_stream_cli_destroy() */
+ return 0;
LOGPCC(link, LOGL_NOTICE, "Disconnected.\n");
LOGPCC(link, LOGL_NOTICE, "Reconnecting...\n");
osmo_stream_cli_reconnect(conn);
@@ -364,10 +366,11 @@
return;
if (link->is_client) {
- osmo_stream_cli_destroy(link->cli_conn);
+ struct osmo_stream_cli *cli_conn = link->cli_conn;
+ link->cli_conn = NULL;
+ osmo_stream_cli_destroy(cli_conn);
if (link->peer)
link->peer->link.cbsp = NULL;
- link->cli_conn = NULL;
if (link->fi)
osmo_fsm_inst_dispatch(link->fi, CBSP_LINK_E_CMD_CLOSE, NULL);
} else {
--
To view, visit
https://gerrit.osmocom.org/c/osmo-cbc/+/38978?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-cbc
Gerrit-Branch: master
Gerrit-Change-Id: I56605766af974d86610d0958f4b82e6e4ff94502
Gerrit-Change-Number: 38978
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin(a)sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann(a)sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: osmith <osmith(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>