pespin has submitted this change. ( https://gerrit.osmocom.org/c/osmo-pcu/+/29910 )
Change subject: rcv_resource_request(): Validate expected message before MS lookup & allocation ......................................................................
rcv_resource_request(): Validate expected message before MS lookup & allocation
There's no sense if doing the lookup and allocation if the message is not expected, it will be unrefed (freed) afterwards anyway. Moreover, this way we avoid doing stuff for the WIP code paths which act on different request ID than TLLI.
Change-Id: I4be8858230a2eebdb33260093d082a005cb9fcd4 --- M src/pdch.cpp 1 file changed, 7 insertions(+), 7 deletions(-)
Approvals: osmith: Looks good to me, but someone else must approve laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified
diff --git a/src/pdch.cpp b/src/pdch.cpp index 369406f..defb6b2 100644 --- a/src/pdch.cpp +++ b/src/pdch.cpp @@ -644,10 +644,16 @@ struct gprs_rlcmac_sba *sba; int rc; struct gprs_rlcmac_bts *bts = trx->bts; + struct pdch_ulc_node *item; + + if (!(item = pdch_ulc_get_node(ulc, fn))) { + LOGPDCH(this, DRLCMAC, LOGL_NOTICE, "FN=%u PKT RESOURCE REQ: " + "UL block not reserved\n", fn); + return; + }
if (request->ID.UnionType) { struct gprs_rlcmac_ul_tbf *ul_tbf = NULL; - struct pdch_ulc_node *item; uint32_t tlli = request->ID.u.TLLI;
GprsMs *ms = bts_ms_by_tlli(bts, tlli, GSM_RESERVED_TMSI); @@ -659,12 +665,6 @@ /* Keep the ms, even if it gets idle temporarily */ ms_ref(ms);
- if (!(item = pdch_ulc_get_node(ulc, fn))) { - LOGPDCH(this, DRLCMAC, LOGL_NOTICE, "FN=%u PKT RESOURCE REQ: " - "UL block not reserved\n", fn); - goto return_unref; - } - switch (item->type) { case PDCH_ULC_NODE_TBF_USF: /* Is it actually valid for an MS to send a PKT Res Req during USF? */