<p>fixeria has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-bts/+/23399">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">osmo-bts-trx: fix segfault on trx_phy_inst_open() failure<br><br>If for whatever reason it fails to initialize the TRXD or TRXC<br>interface, trx_phy_inst_open() would return an error.  This<br>would cause bts_model_phy_link_open() to call trx_if_close()<br>on each of the PHY links, including those that were never<br>opened.  This leads to a segfault in trx_if_close().<br><br>Make sure that in trx_if_init() we properly init 'struct trx_l1h',<br>so it's safe to call trx_if_close() at any time and in any state.<br><br>Change-Id: I1f128813528f505fede04799e84456f6271058d0<br>---<br>M src/osmo-bts-trx/trx_if.c<br>1 file changed, 6 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/99/23399/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c</span><br><span>index c6701cb..2e97319 100644</span><br><span>--- a/src/osmo-bts-trx/trx_if.c</span><br><span>+++ b/src/osmo-bts-trx/trx_if.c</span><br><span>@@ -193,6 +193,12 @@</span><br><span> {</span><br><span>      l1h->trx_ctrl_timer.cb = trx_ctrl_timer_cb;</span><br><span>       l1h->trx_ctrl_timer.data = l1h;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  /* initialize ctrl queue */</span><br><span style="color: hsl(120, 100%, 40%);">+   INIT_LLIST_HEAD(&l1h->trx_ctrl_list);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+        l1h->trx_ofd_ctrl.fd = -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ l1h->trx_ofd_data.fd = -1;</span><br><span> }</span><br><span> </span><br><span> /*! Send a new TRX control command.</span><br><span>@@ -1215,9 +1221,6 @@</span><br><span> </span><br><span>    LOGPPHI(l1h->phy_inst, DTRX, LOGL_NOTICE, "Open transceiver\n");</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-       /* initialize ctrl queue */</span><br><span style="color: hsl(0, 100%, 40%);">-     INIT_LLIST_HEAD(&l1h->trx_ctrl_list);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span>         /* open sockets */</span><br><span>   rc = trx_udp_open(l1h, &l1h->trx_ofd_ctrl,</span><br><span>                      plink->u.osmotrx.local_ip,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bts/+/23399">change 23399</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-bts/+/23399"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-bts </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I1f128813528f505fede04799e84456f6271058d0 </div>
<div style="display:none"> Gerrit-Change-Number: 23399 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>