<p style="white-space: pre-wrap; word-wrap: break-word;">thanks for the review!<br>I'm afraid I have to negate every change request made, though...</p><p style="white-space: pre-wrap; word-wrap: break-word;">Let's get rid of this osmo-bsc crash by OSMO_ASSERT(conn->bts) now?</p><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907">View Change</a></p><p>5 comments:</p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/include/osmocom/bsc/gsm_data.h">File include/osmocom/bsc/gsm_data.h:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/include/osmocom/bsc/gsm_data.h@1376">Patch Set #5, Line 1376:</a> <code style="font-family:monospace,monospace">   if (!conn || !conn->lchan)</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I'd rather check only for !conn->lchan, I would assume conn is always there and if it's not there is […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">no harm done by it, so I'm just keeping this</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/assignment_fsm.c">File src/osmo-bsc/assignment_fsm.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/assignment_fsm.c@83">Patch Set #5, Line 83:</a> <code style="font-family:monospace,monospace">         if (bts) \</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">what about logging if !bts?</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">this macro is supposed to silently count rate counters in various situations, if there is no bts then just don't count a bts and done</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/gsm_data.c">File src/osmo-bsc/gsm_data.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/gsm_data.c@1724">Patch Set #5, Line 1724:</a> <code style="font-family:monospace,monospace">   if (bts && conn->lchan)</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">But we still need the check since we dereference bts->ms_max_power in the next line, so what do we g […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">what he said</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/osmo_bsc_bssap.c">File src/osmo-bsc/osmo_bsc_bssap.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/osmo_bsc_bssap.c@477">Patch Set #5, Line 477:</a> <code style="font-family:monospace,monospace">static int bssmap_handle_cipher_mode(struct gsm_subscriber_connection *conn,</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">I think it belongs in this patch, but I don't think we should use global variables (like bsc_gsmnet) […]</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">In this function, the only reason to use conn_get_bts() was to get at the global singleton bsc_gsmnet.<br>It is always there, and it makes no sense to not be able to access it just because there currently is no lchan assigned. </p><p style="white-space: pre-wrap; word-wrap: break-word;">The fact that this function should always have an lchan aside: the point of this patch is to safeguard against odd failure modes where an lchan disappeared unexpectedly, and to make sure there is no DoS.</p><p style="white-space: pre-wrap; word-wrap: break-word;">I was all against a global gsmnet myself for a while, but in practice, there is no use in passing it around as function args. There is only one bsc_gsmnet, there will always be just one, and there is absolutely nothing gained now nor ever in any future by making it complicated to obtain a reference to it.</p></li></ul></li><li style="margin: 0; padding: 0;"><p><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/osmo_bsc_msc.c">File src/osmo-bsc/osmo_bsc_msc.c:</a></p><ul style="list-style: none; padding: 0;"><li style="margin: 0; padding: 0 0 0 16px;"><p style="margin-bottom: 4px;"><a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907/5/src/osmo-bsc/osmo_bsc_msc.c@239">Patch Set #5, Line 239:</a> <code style="font-family:monospace,monospace">               return NULL;</code></p><p><blockquote style="border-left: 1px solid #aaa; margin: 10px 0; padding: 0 10px;">OSMO_ASSERT(bts) here looks better.</blockquote></p><p style="white-space: pre-wrap; word-wrap: break-word;">no, because getting rid of an assert like that is exactly the aim of this patch.<br>All cgi_for_msc() callers handle a NULL return val properly.</p></li></ul></li></ul><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-bsc/+/18907">change 18907</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-bsc/+/18907"/><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-Change-Id: Id681dfb0ad654bdb4b71805d1ad4f39a8bf6bbd1 </div>
<div style="display:none"> Gerrit-Change-Number: 18907 </div>
<div style="display:none"> Gerrit-PatchSet: 5 </div>
<div style="display:none"> Gerrit-Owner: fixeria <vyanitskiy@sysmocom.de> </div>
<div style="display:none"> Gerrit-Assignee: neels <nhofmeyr@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-CC: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-CC: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 23 Jun 2020 12:29:43 +0000 </div>
<div style="display:none"> Gerrit-HasComments: Yes </div>
<div style="display:none"> Gerrit-Has-Labels: No </div>
<div style="display:none"> Comment-In-Reply-To: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Comment-In-Reply-To: daniel <dwillmann@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: comment </div>