Change in osmo-pcu[master]: coverity: fix null deref from recent UL TBF leak fix

laforge gerrit-no-reply at lists.osmocom.org
Thu Aug 19 14:51:42 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/25203 )

Change subject: coverity: fix null deref from recent UL TBF leak fix
......................................................................

coverity: fix null deref from recent UL TBF leak fix

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

Related: OS#5205 SYS#5561 CID#239246
Change-Id: I603d4a5bc0fe5bd2e9f0dba171604c459e38aeaf
---
M src/bts.cpp
1 file changed, 6 insertions(+), 3 deletions(-)

Approvals:
  Jenkins Builder: Verified
  fixeria: Looks good to me, but someone else must approve
  dexter: Looks good to me, approved



diff --git a/src/bts.cpp b/src/bts.cpp
index b5fdfee..a40e071 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -1162,13 +1162,16 @@
 {
 	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

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/25203
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I603d4a5bc0fe5bd2e9f0dba171604c459e38aeaf
Gerrit-Change-Number: 25203
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: fixeria <vyanitskiy at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210819/de4831b4/attachment.htm>


More information about the gerrit-log mailing list