<p>pespin has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/osmo-pcu/+/22489">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">NACC: Fix crash freeing struct if CTRL conn was refused during alloc<br><br>Older versions of osmo_ctrl_conn_alloc() may not properly initialize<br>write_queue.bfd.fd to -1, which means if osmo_sock_init2_ofd() failed<br>during nacc_fsm_alloc(), the destructor would wrongly enter the conditon<br>where the whole structure is set and unregister the unregistered fd.<br><br>Related: libosmocore Change-Id I98f744d2880fbb883719cdf1d3eb31f2b22a13b6<br>Related: SYS#4909<br>Change-Id: I253bd9087b1f7ab039aa1127e9dc586f5106905a<br>---<br>M src/nacc_fsm.c<br>1 file changed, 3 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/89/22489/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/nacc_fsm.c b/src/nacc_fsm.c</span><br><span>index 0a20ae6..b8350a6 100644</span><br><span>--- a/src/nacc_fsm.c</span><br><span>+++ b/src/nacc_fsm.c</span><br><span>@@ -623,6 +623,9 @@</span><br><span>        ctx->neigh_ctrl_conn = osmo_ctrl_conn_alloc(ctx, ctx->neigh_ctrl);</span><br><span>     if (!ctx->neigh_ctrl_conn)</span><br><span>                goto free_ret;</span><br><span style="color: hsl(120, 100%, 40%);">+        /* Older versions of osmo_ctrl_conn_alloc didn't properly initialize fd to -1,</span><br><span style="color: hsl(120, 100%, 40%);">+     * so make sure to do it here otherwise fd may be valid fd 0 and cause trouble */</span><br><span style="color: hsl(120, 100%, 40%);">+     ctx->neigh_ctrl_conn->write_queue.bfd.fd = -1;</span><br><span>         llist_add(&ctx->neigh_ctrl_conn->list_entry, &ctx->neigh_ctrl->ccon_list);</span><br><span> </span><br><span>   rc = osmo_sock_init2_ofd(&ctx->neigh_ctrl_conn->write_queue.bfd,</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-pcu/+/22489">change 22489</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/+/22489"/><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: I253bd9087b1f7ab039aa1127e9dc586f5106905a </div>
<div style="display:none"> Gerrit-Change-Number: 22489 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>