<p>Pau Espin Pedrol <strong>merged</strong> this change.</p><p><a href="https://gerrit.osmocom.org/10566">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Neels Hofmeyr: Looks good to me, approved
Jenkins Builder: Verified
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">abis_nm: Fix heap-use-after-free in abis_nm_set_channel_attr<br><br>LOGPFOH uses the msgb through "foh", so we have to free msgb after<br>calling it, not before.<br><br>Fixes following ASAN report:<br>[0;m[1;36m20180822120155990 [1;34mDNM[0;m[1;36m <0004> abis_nm.c:1889 OC=CHANNEL(03) INST=(00,01,06): Set Chan Attr (bts=0,trx=1,ts=6)<br>[0;m=================================================================<br>==16465==ERROR: AddressSanitizer: heap-use-after-free on address 0x61a00002b3f0 at pc 0x7f587f44c0db bp 0x7ffc59e31df0 sp 0x7ffc59e31de8<br>READ of size 1 at 0x61a00002b3f0 thread T0<br> #0 0x7f587f44c0da in abis_nm_dump_foh libosmocore/src/gsm/abis_nm.c:937<br> #1 0x561e09e1532c in abis_nm_set_channel_attr osmo-bsc/src/osmo-bsc/abis_nm.c:1892<br> #2 0x561e09efd269 in nm_statechg_event osmo-bsc/src/osmo-bsc/bts_ipaccess_nanobts.c:168<br> #3 0x561e09efd269 in bts_ipa_nm_sig_cb osmo-bsc/src/osmo-bsc/bts_ipaccess_nanobts.c:335<br> #4 0x7f587efb3d16 in osmo_signal_dispatch libosmocore/src/signal.c:120<br> #5 0x561e09e18e31 in abis_nm_rx_statechg_rep osmo-bsc/src/osmo-bsc/abis_nm.c:255<br> #6 0x561e09e18e31 in abis_nm_rcvmsg_report osmo-bsc/src/osmo-bsc/abis_nm.c:380<br> #7 0x561e09e18e31 in abis_nm_rcvmsg_fom osmo-bsc/src/osmo-bsc/abis_nm.c:778<br> #8 0x561e09e1dc19 in abis_nm_rcvmsg osmo-bsc/src/osmo-bsc/abis_nm.c:926<br> #9 0x7f587ec90cc2 in handle_ts1_read input/ipaccess.c:274<br> #10 0x7f587ec90cc2 in ipaccess_fd_cb input/ipaccess.c:389<br> #11 0x7f587efb1ca8 in osmo_fd_disp_fds libosmocore/src/select.c:217<br> #12 0x7f587efb1ca8 in osmo_select_main libosmocore/src/select.c:257<br> #13 0x561e09e049d6 in main osmo-bsc/src/osmo-bsc/osmo_bsc_main.c:922<br> #14 0x7f587d53a2e0 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x202e0)<br> #15 0x561e09e054e9 in _start (/bin/osmo-bsc+0x34d4e9)<br><br>Fixes: OS#3494<br>Change-Id: I030117abfdcee387516a4dea7e1e6a9bae8055f6<br>---<br>M src/osmo-bsc/abis_nm.c<br>1 file changed, 1 insertion(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/osmo-bsc/abis_nm.c b/src/osmo-bsc/abis_nm.c</span><br><span>index d056bc4..f59a4fe 100644</span><br><span>--- a/src/osmo-bsc/abis_nm.c</span><br><span>+++ b/src/osmo-bsc/abis_nm.c</span><br><span>@@ -1888,9 +1888,9 @@</span><br><span> </span><br><span> DEBUGPFOH(DNM, foh, "Set Chan Attr %s\n", gsm_ts_name(ts));</span><br><span> if (verify_chan_comb(ts, chan_comb, &reason) < 0) {</span><br><span style="color: hsl(0, 100%, 40%);">- msgb_free(msg);</span><br><span> LOGPFOH(DNM, LOGL_ERROR, foh, "Invalid Channel Combination %d on %s. Reason: %s\n",</span><br><span> chan_comb, gsm_ts_name(ts), reason);</span><br><span style="color: hsl(120, 100%, 40%);">+ msgb_free(msg);</span><br><span> return -EINVAL;</span><br><span> }</span><br><span> ts->nm_chan_comb = chan_comb;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/10566">change 10566</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/10566"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: osmo-bsc </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I030117abfdcee387516a4dea7e1e6a9bae8055f6 </div>
<div style="display:none"> Gerrit-Change-Number: 10566 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder (1000002) </div>
<div style="display:none"> Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-Reviewer: Pau Espin Pedrol <pespin@sysmocom.de> </div>