This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Harald Welte gerrit-no-reply at lists.osmocom.orgHarald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10600 )
Change subject: ipa: don't crash on missing IPA ID GET message
......................................................................
ipa: don't crash on missing IPA ID GET message
ipaccess_bts_read_cb() only initializes signalling links if it has received an
IPA ID GET message on it, and so far happily accesses the uninitialized
sign_links list anyway if it hasn't.
Reproduce: simply don't send an IPA ID GET message when connecting to an IPA
server run by libosmo-abis, then continue to use the link --> segfault.
Fix the segfault: make sure that the e1inp_ts' type has been set, i.e. that
e1inp_ts_config_sign() has been called and the sign_links llist is initialized,
before calling e1inp_lookup_sign_link() on it.
../../../src/libosmo-abis/src/e1_input.c:511:2: runtime error: member access within null pointer of type 'struct e1inp_sign_link'
../../../src/libosmo-abis/src/e1_input.c:512:11: runtime error: member access within null pointer of type 'struct e1inp_sign_link'
ASAN:SIGSEGV
=================================================================
==5702==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000038 (pc 0x7f28a379ea34 sp 0x7ffd7d8933f0 bp 0x62e000000a98 T0)
#0 0x7f28a379ea33 in e1inp_lookup_sign_link ../../../src/libosmo-abis/src/e1_input.c:512
#1 0x7f28a37b97d4 in ipaccess_bts_read_cb ../../../src/libosmo-abis/src/input/ipaccess.c:778
#2 0x7f28a37b0277 in ipa_client_read ../../../src/libosmo-abis/src/input/ipa.c:76
#3 0x7f28a37b0277 in ipa_client_fd_cb ../../../src/libosmo-abis/src/input/ipa.c:139
#4 0x7f28a2ac1a34 in osmo_fd_disp_fds ../../../src/libosmocore/src/select.c:217
#5 0x7f28a2ac1a34 in osmo_select_main ../../../src/libosmocore/src/select.c:257
#6 0x444ba3 in bts_main ../../../../src/osmo-bts/src/common/main.c:364
#7 0x7f28a17ddb44 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x21b44)
#8 0x405e54 (/usr/local/bin/osmo-bts-trx+0x405e54)
Related: OS#3498
Change-Id: I2487ca37a0fe9aa56733f66bcad9dcf91fc11144
---
M src/input/ipaccess.c
1 file changed, 8 insertions(+), 4 deletions(-)
Approvals:
Jenkins Builder: Verified
Harald Welte: Looks good to me, approved
diff --git a/src/input/ipaccess.c b/src/input/ipaccess.c
index ac61e14..cce1654 100644
--- a/src/input/ipaccess.c
+++ b/src/input/ipaccess.c
@@ -727,12 +727,11 @@
struct ipaccess_head *hh = (struct ipaccess_head *) msg->data;
struct e1inp_ts *e1i_ts = NULL;
struct e1inp_sign_link *sign_link;
+ uint8_t msg_type = *(msg->l2h);
int ret = 0;
/* special handling for IPA CCM. */
if (hh->proto == IPAC_PROTO_IPACCESS) {
- uint8_t msg_type = *(msg->l2h);
-
/* this is a request for identification from the BSC. */
if (msg_type == IPAC_MSGT_ID_GET) {
if (!link->line->ops->sign_link_up) {
@@ -751,8 +750,6 @@
goto err;
if (ret == 1 && hh->proto == IPAC_PROTO_IPACCESS) {
- uint8_t msg_type = *(msg->l2h);
-
if (msg_type == IPAC_MSGT_ID_GET) {
sign_link = link->line->ops->sign_link_up(msg,
link->line,
@@ -774,6 +771,13 @@
OSMO_ASSERT(e1i_ts != NULL);
+ if (e1i_ts->type == E1INP_TS_TYPE_NONE) {
+ LOGP(DLINP, LOGL_ERROR, "Signalling link not initialized. Discarding."
+ " port=%u msg_type=%u\n", link->port, msg_type);
+ ret = -EIO;
+ goto err;
+ }
+
/* look up for some existing signaling link. */
sign_link = e1inp_lookup_sign_link(e1i_ts, hh->proto, 0);
if (sign_link == NULL) {
--
To view, visit https://gerrit.osmocom.org/10600
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I2487ca37a0fe9aa56733f66bcad9dcf91fc11144
Gerrit-Change-Number: 10600
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180824/5adaaf20/attachment.htm>