Change in osmo-bts[master]: l1sap: Avoid re-(de)activating already (de)active lchans

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/.

pespin gerrit-no-reply at lists.osmocom.org
Tue Oct 26 16:32:40 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/25965 )


Change subject: l1sap: Avoid re-(de)activating already (de)active lchans
......................................................................

l1sap: Avoid re-(de)activating already (de)active lchans

This avoids triggering all sorts of unexpected paths where one tries to
release an already released lchan, etc.
This can happen for instance if BTS shuts down due to BSC link going
down, and hence resets all lchans, announcing it to the PCU. Then the
PCU may try to deactivate the channel sending act_req (disable), but the
BTS already unilaterally dropped the channels.
That code path seems to trigger some crash, probably because something
in lchan has been freed.

Related: SYS#4971
Change-Id: I093e4d4e23b527b10bf5d6ff538460626c30a8f8
---
M src/common/l1sap.c
1 file changed, 13 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/65/25965/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index c89b2c3..2338996 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1961,6 +1961,12 @@
 	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, chan_nr);
 	int rc;
 
+	if (lchan->state == LCHAN_S_ACTIVE) {
+		LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Trying to activate already active channel %s\n",
+			  rsl_chan_nr_str(chan_nr));
+		return -1;
+	}
+
 	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "Activating channel %s\n", rsl_chan_nr_str(chan_nr));
 
 	lchan->s = trx->bts->radio_link_timeout.current;
@@ -1994,6 +2000,13 @@
 int l1sap_chan_rel(struct gsm_bts_trx *trx, uint8_t chan_nr)
 {
 	struct gsm_lchan *lchan = get_lchan_by_chan_nr(trx, chan_nr);
+
+	if (lchan->state == LCHAN_S_NONE) {
+		LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "Trying to deactive already deactivated channel %s\n",
+			  rsl_chan_nr_str(chan_nr));
+		return -1;
+	}
+
 	LOGPLCHAN(lchan, DL1C, LOGL_INFO, "Deactivating channel %s\n",
 		  rsl_chan_nr_str(chan_nr));
 

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

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I093e4d4e23b527b10bf5d6ff538460626c30a8f8
Gerrit-Change-Number: 25965
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211026/d452748f/attachment.htm>


More information about the gerrit-log mailing list