coverity: fix null deref from recent UL TBF leak fix

Fix a possible NULL deref, introduced in recent patch
I8ce21be6836549b47a606c00b793d6f005964c5c /
d8e8ea9c8f

Related: OS#5205 SYS#5561 CID#239246
Change-Id: I603d4a5bc0fe5bd2e9f0dba171604c459e38aeaf
This commit is contained in:
Neels Hofmeyr 2021-08-18 18:23:42 +02:00
parent d8e8ea9c8f
commit 3bd6488889
1 changed files with 6 additions and 3 deletions

View File

@ -1162,13 +1162,16 @@ void bts_update_tbf_ta(struct gprs_rlcmac_bts *bts, const char *p, uint32_t fn,
{
struct gprs_rlcmac_pdch *pdch = &bts->trx[trx_no].pdch[ts];
struct pdch_ulc_node *poll = pdch_ulc_get_node(pdch->ulc, fn);
struct gprs_rlcmac_ul_tbf *ul_tbf = as_ul_tbf(poll->tbf_poll.poll_tbf);
struct gprs_rlcmac_ul_tbf *ul_tbf;
if (!poll || poll->type !=PDCH_ULC_NODE_TBF_POLL ||
poll->tbf_poll.poll_tbf->direction != GPRS_RLCMAC_UL_TBF)
poll->tbf_poll.poll_tbf->direction != GPRS_RLCMAC_UL_TBF) {
LOGP(DL1IF, LOGL_DEBUG, "[%s] update TA = %u ignored due to "
"unknown UL TBF on TRX = %d, TS = %d, FN = %d\n",
p, ta, trx_no, ts, fn);
else if (ul_tbf) {
return;
}
ul_tbf = as_ul_tbf(poll->tbf_poll.poll_tbf);
if (ul_tbf) {
/* we need to distinguish TA information provided by L1
* from PH-DATA-IND and PHY-RA-IND so that we can properly
* update TA for given TBF