aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2020-05-09 08:04:47 +0200
committerlaforge <laforge@osmocom.org>2020-05-09 08:05:21 +0000
commit89aa40df7946a8237287dd7bc0041834f89eb12c (patch)
treefdcff1926e1ec0e2f46d8a43c6e985603b28308a /src
parent57a1ec5b2eda59ad84e52dc22db1f4f3c9e13914 (diff)
om2k: Fix invalid use of linked list when building hopping freq list
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
Diffstat (limited to 'src')
-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;
}