aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2020-05-09 08:04:47 +0200
committerSylvain Munaut <tnt@246tNt.com>2020-05-09 08:04:47 +0200
commit721574b6753e133dea981587f6f09ab7ef9c26a1 (patch)
treec7d23e9c2bf04e8b3012f6d87d71ef75f9d91283
parent908e82e2d9f7f5b80a4a28ac6f6b9d691653f206 (diff)
om2k: Fix invalid use of linked list when building hopping freq listtnt/rbs
I originally assumed that after a complete scan with llist_for_each_entry the loop counter would be either NULL or a valid entry. That's just not the case. Fixes: CID#210256 Signed-off-by: Sylvain Munaut <tnt@246tNt.com> Change-Id: Iad647b74771c4ac406a88effd371ed7748c8847e
-rw-r--r--src/osmo-bsc/abis_om2000.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/osmo-bsc/abis_om2000.c b/src/osmo-bsc/abis_om2000.c
index c69655732..0aea684c0 100644
--- a/src/osmo-bsc/abis_om2000.c
+++ b/src/osmo-bsc/abis_om2000.c
@@ -1452,14 +1452,16 @@ static uint8_t ts2comb(struct gsm_bts_trx_ts *ts)
static int put_freq_list(uint8_t *buf, struct gsm_bts_trx_ts *ts, uint16_t arfcn)
{
- struct gsm_bts_trx *trx;
+ struct gsm_bts_trx *t, *trx = NULL;
/* Find the TRX that's configured for that ARFCN */
- llist_for_each_entry(trx, &ts->trx->bts->trx_list, list)
- if (trx->arfcn == arfcn)
+ llist_for_each_entry(t, &ts->trx->bts->trx_list, list)
+ if (t->arfcn == arfcn) {
+ trx = t;
break;
+ }
- if (!trx || (trx->arfcn != arfcn)) {
+ if (!trx) {
LOGP(DNM, LOGL_ERROR, "Trying to use ARFCN %d for hopping with no TRX configured for it", arfcn);
return 0;
}