Change in osmo-bsc[master]: lchan/gscon: always clear both cross ref pointers

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
Fri Dec 17 13:55:15 UTC 2021


neels has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26610 )


Change subject: lchan/gscon: always clear both cross ref pointers
......................................................................

lchan/gscon: always clear both cross ref pointers

During specific release scenarios, it became clear that an lchan still
pointed at a conn even after it had been deallocated. That was due to
setting conn->lchan = NULL but not lchan->conn = NULL. Fix that.

Do lchan_forget_conn() first, because during gscon_forget_lchan() we may
enter the gscon clearing dance, which in case of no SCCP conn being
present will soon / should immediately deallocate the conn.

Related: OS#5337
Related: I8c8537acf6b47b121903197608636c43ae601a57 (osmo-bsc)
Change-Id: Idbfe4672233ba8105eff5ba77ee07fd871358255
---
M src/osmo-bsc/lchan_fsm.c
1 file changed, 7 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/10/26610/1

diff --git a/src/osmo-bsc/lchan_fsm.c b/src/osmo-bsc/lchan_fsm.c
index 5ae6df6..84f8dc5 100644
--- a/src/osmo-bsc/lchan_fsm.c
+++ b/src/osmo-bsc/lchan_fsm.c
@@ -478,8 +478,11 @@
 {
 	LOG_LCHAN(lchan, LOGL_DEBUG, "Clearing lchan state\n");
 
-	if (lchan->conn)
-		gscon_forget_lchan(lchan->conn, lchan);
+	if (lchan->conn) {
+		struct gsm_subscriber_connection *conn = lchan->conn;
+		lchan_forget_conn(lchan);
+		gscon_forget_lchan(conn, lchan);
+	}
 
 	if (lchan->rqd_ref) {
 		talloc_free(lchan->rqd_ref);
@@ -1392,8 +1395,9 @@
 	 * lchan_reset(), we make sure it does. But in case of releases from error handling, the
 	 * conn might as well notice now already that its lchan is becoming unusable. */
 	if (lchan->conn) {
-		gscon_forget_lchan(lchan->conn, lchan);
+		struct gsm_subscriber_connection *conn = lchan->conn;
 		lchan_forget_conn(lchan);
+		gscon_forget_lchan(conn, lchan);
 	}
 
 	rc = rsl_tx_rf_chan_release(lchan);

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: Idbfe4672233ba8105eff5ba77ee07fd871358255
Gerrit-Change-Number: 26610
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211217/9f382067/attachment.htm>


More information about the gerrit-log mailing list