Change in osmo-bsc[master]: fix segfault introduced by recent segfault fix

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

neels gerrit-no-reply at lists.osmocom.org
Wed Jun 24 00:50:06 UTC 2020


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

Change subject: fix segfault introduced by recent segfault fix
......................................................................

fix segfault introduced by recent segfault fix

This recently merged patch introduced a new bad segfault in bsc_compl_l3() by
dereferencing conn->sccp.msc before it was set to the actual msc pointer:

commit 6281d4f8692729dc0022ea7a6a2068972d58e9b6
"fix crashes due to OSMO_ASSERT(conn->lchan)"
Change-Id Id681dfb0ad654bdb4b71805d1ad4f39a8bf6bbd1

Fix that by moving the new checks back further down in bsc_compl_l3(), to where
conn->sccp.msc actually points at the msc.

Change-Id: Ic5832da7c58fce583caa504a90f18c334fc234f2
---
M src/osmo-bsc/gsm_08_08.c
1 file changed, 12 insertions(+), 9 deletions(-)

Approvals:
  neels: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/osmo-bsc/gsm_08_08.c b/src/osmo-bsc/gsm_08_08.c
index e288506..2829b67 100644
--- a/src/osmo-bsc/gsm_08_08.c
+++ b/src/osmo-bsc/gsm_08_08.c
@@ -480,15 +480,8 @@
 	struct msgb *resp;
 	struct gsm0808_speech_codec_list scl;
 	int rc = -2;
-	struct gsm_bts *bts = conn_get_bts(conn);
-	struct osmo_cell_global_id *cgi = cgi_for_msc(conn->sccp.msc, bts);
-
-	if (!bts || !cgi) {
-		/* should never happen */
-		LOGP(DMSC, LOGL_ERROR, "Compl L3 without lchan\n");
-		rc = -1;
-		goto early_fail;
-	}
+	struct gsm_bts *bts;
+	struct osmo_cell_global_id *cgi;
 
 	log_set_context(LOG_CTX_BSC_SUBSCR, conn->bsub);
 
@@ -506,6 +499,16 @@
 	if (osmo_bsc_sigtran_new_conn(conn, msc) != BSC_CON_SUCCESS)
 		goto early_fail;
 
+	bts = conn_get_bts(conn);
+	cgi = cgi_for_msc(conn->sccp.msc, bts);
+
+	if (!bts || !cgi) {
+		/* should never happen */
+		LOGP(DMSC, LOGL_ERROR, "Compl L3 without lchan\n");
+		rc = -1;
+		goto early_fail;
+	}
+
 	bsc_scan_bts_msg(conn, msg);
 
 	if (gscon_is_aoip(conn)) {

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Ic5832da7c58fce583caa504a90f18c334fc234f2
Gerrit-Change-Number: 18993
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200624/aa98868b/attachment.htm>


More information about the gerrit-log mailing list