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
This commit is contained in:
Sylvain Munaut 2020-05-09 08:04:47 +02:00 committed by laforge
parent 57a1ec5b2e
commit 89aa40df79
1 changed files with 6 additions and 4 deletions

View File

@ -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;
}