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/.
Max gerrit-no-reply at lists.osmocom.org
Review at https://gerrit.osmocom.org/1276
TRX: prevent segfault upon phy init or cleanup
Previously if multiply phy instances were configured but not used
osmo-bts-trx would segfault.
Change-Id: Id979506731ea92401458f1060e87aeb690901539
---
M src/common/scheduler.c
M src/osmo-bts-trx/l1_if.c
M src/osmo-bts-trx/trx_if.c
3 files changed, 12 insertions(+), 6 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/76/1276/1
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index db1f977..fd5c584 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -166,6 +166,9 @@
uint8_t tn;
unsigned int i;
+ if (!trx)
+ return -EINVAL;
+
l1t->trx = trx;
LOGP(DL1C, LOGL_NOTICE, "Init scheduler for trx=%u\n", l1t->trx->nr);
diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c
index ea2088b..8bafe8c 100644
--- a/src/osmo-bts-trx/l1_if.c
+++ b/src/osmo-bts-trx/l1_if.c
@@ -71,17 +71,18 @@
return NULL;
l1h->phy_inst = pinst;
- trx_sched_init(&l1h->l1s, pinst->trx);
+ rc = trx_sched_init(&l1h->l1s, pinst->trx);
+ if (rc < 0)
+ goto err;
rc = trx_if_open(l1h);
- if (rc < 0) {
- LOGP(DL1C, LOGL_FATAL, "Cannot initialize scheduler\n");
+ if (rc < 0)
goto err;
- }
return l1h;
err:
+ LOGP(DL1C, LOGL_FATAL, "Cannot initialize scheduler\n");
l1if_close(l1h);
return NULL;
}
diff --git a/src/osmo-bts-trx/trx_if.c b/src/osmo-bts-trx/trx_if.c
index 42d383c..c5bdcd8 100644
--- a/src/osmo-bts-trx/trx_if.c
+++ b/src/osmo-bts-trx/trx_if.c
@@ -618,8 +618,10 @@
while (!llist_empty(&l1h->trx_ctrl_list)) {
tcm = llist_entry(l1h->trx_ctrl_list.next, struct trx_ctrl_msg,
list);
- llist_del(&tcm->list);
- talloc_free(tcm);
+ if (tcm) {
+ llist_del(&tcm->list);
+ talloc_free(tcm);
+ }
}
}
--
To view, visit https://gerrit.osmocom.org/1276
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id979506731ea92401458f1060e87aeb690901539
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>