<p>pespin <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/20254">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">Fix crash accessing NULL tbf->pdch[first_ts]<br><br>Fixes consistent crash under some specific scenarios explained in<br>OS#4756.<br><br>The crash was caused due to a bug in channel allocator algorithm<br>incorrectly populating tbf->pdch[] array as a result of mismatching<br>first_ts and resulting pdch selected slot bitmask.<br><br>The issue happens because when allocating a UL TBF in allocator B, the<br>subset is always further forced into allocating one single TS. As a<br>result, on that branch several variables are updated, but first_ts was<br>not.<br><br>The field used to be updated in older versions, but a bug was introduced<br>during code refactoring in commit listed below (31 Jan 2018).<br><br>Fixes: 0cc7212cfdfd40e87b531ecf14e76356185f4036<br>Related: OS#4756<br>Change-Id: I79596803f7dab6f21b58bfe39c2af65d9c5b39d5<br>---<br>M src/gprs_rlcmac_ts_alloc.cpp<br>1 file changed, 1 insertion(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gprs_rlcmac_ts_alloc.cpp b/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>index 836dab5..496d19b 100644</span><br><span>--- a/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>+++ b/src/gprs_rlcmac_ts_alloc.cpp</span><br><span>@@ -896,8 +896,6 @@</span><br><span>   if (rc < 0)</span><br><span>               return -EINVAL;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-     first_ts = ffs(rc) - 1;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>      /* Step 3b: Derive the slot set for a given direction */</span><br><span>     if (tbf->direction == GPRS_RLCMAC_DL_TBF) {</span><br><span>               dl_slots = rc;</span><br><span>@@ -914,6 +912,7 @@</span><br><span>                 update_slot_counters(ul_slots, reserved_ul_slots, &slotcount, &avail_count);</span><br><span>         }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ first_ts = ffs(rc) - 1;</span><br><span>      first_common_ts = ffs(dl_slots & ul_slots) - 1;</span><br><span> </span><br><span>      if (first_common_ts < 0) {</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/20254">change 20254</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-pcu/+/20254"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-pcu </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I79596803f7dab6f21b58bfe39c2af65d9c5b39d5 </div>
<div style="display:none"> Gerrit-Change-Number: 20254 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>