diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-10-26 18:00:17 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-10-26 18:57:16 +0200 |
commit | 887fa01977c8f4a24b91aeb3a7298035a0f0425c (patch) | |
tree | 54c804d5c4561fe4d58c7159a8baeacb84cfc7b3 /src | |
parent | c2ae1df89035f0255969f0332ea1f4f27267d0f5 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/common/l1sap.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/common/l1sap.c b/src/common/l1sap.c index c89b2c3c..f1d1575e 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -1961,6 +1961,12 @@ int l1sap_chan_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed * 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_act(struct gsm_bts_trx *trx, uint8_t chan_nr, struct tlv_parsed * 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)); |