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
Wed Oct 27 13:00:14 UTC 2021


pespin has submitted this change. ( 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(-)

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



diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index c89b2c3..f1d1575 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 deactivate 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: 2
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel <dwillmann at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
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/20211027/d56334a4/attachment.htm>


More information about the gerrit-log mailing list