diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-10-26 18:18:27 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2021-10-26 18:57:24 +0200 |
commit | b71d2f5a4b5705067e6bd1622e03b199e53c491b (patch) | |
tree | 2bb48b4a4b548a70111870336ef483781e20935c | |
parent | 887fa01977c8f4a24b91aeb3a7298035a0f0425c (diff) |
scheduler: Avoid crash upon call to trx_sched_set_lchan if l1ts is uninitialized
It could happen if for instance l1 code called trx_sched_clean() when
closing the phy, and after that some code called (erroneously)
trx_sched_set_lchan(). Let's make sure we don't allow other modules to
crash the process when using this function.
Related: SYS#4971
Change-Id: I93af7c3dcf0e34e9317eec0ee183dbf18b8d2f3b
-rw-r--r-- | src/common/scheduler.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/common/scheduler.c b/src/common/scheduler.c index c068ea04..03884451 100644 --- a/src/common/scheduler.c +++ b/src/common/scheduler.c @@ -1085,6 +1085,12 @@ int trx_sched_set_lchan(struct gsm_lchan *lchan, uint8_t chan_nr, uint8_t link_i bool found = false; int i; + if (!l1ts) { + LOGPLCHAN(lchan, DL1C, LOGL_ERROR, "%s lchan with uninitialized scheduler structure\n", + (active) ? "Activating" : "Deactivating"); + return -EINVAL; + } + /* VAMOS: convert Osmocom specific channel number to a generic one, * otherwise we won't match anything in trx_chan_desc[]. */ if (lchan->ts->vamos.is_shadow) |