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.
Change subject: check for missing result of rate_ctr_group_alloc()
......................................................................
check for missing result of rate_ctr_group_alloc()
In case the counter group allocation fails, we must handle this
gracefully and fail the allocation of the parent object, too.
Change-Id: Id6d780c67b4af15aaa5c6f2b8b00f2a0b70a7385
Related: OS#2361
---
M src/bts.cpp
M src/tbf.cpp
2 files changed, 26 insertions(+), 0 deletions(-)
Approvals:
Vadim Yanitskiy: Looks good to me, but someone else must approve
Harald Welte: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/src/bts.cpp b/src/bts.cpp
index 5192646..2d289d7 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -207,7 +207,9 @@
}
m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
+ OSMO_ASSERT(m_ratectrs);
m_statg = osmo_stat_item_group_alloc(tall_pcu_ctx, &bts_statg_desc, 0);
+ OSMO_ASSERT(m_statg);
}
BTS::~BTS()
diff --git a/src/tbf.cpp b/src/tbf.cpp
index 48e8289..bbed29c 100644
--- a/src/tbf.cpp
+++ b/src/tbf.cpp
@@ -760,6 +760,10 @@
tbf->name(), tbf->trx->trx_no, tbf->ul_slots(), tbf->dl_slots());
tbf->m_ctrs = rate_ctr_group_alloc(tbf, &tbf_ctrg_desc, 0);
+ if (!tbf->m_ctrs) {
+ LOGP(DRLCMAC, LOGL_ERROR, "Couldn't allocate TBF counters\n");
+ return -1;
+ }
return 0;
}
@@ -844,6 +848,11 @@
tbf->m_ul_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_egprs_ctrg_desc, 0);
tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_ul_gprs_ctrg_desc, 0);
+ if (!tbf->m_ul_egprs_ctrs || !tbf->m_ul_gprs_ctrs) {
+ LOGP(DRLCMAC, LOGL_ERROR, "Couldn't allocate TBF UL counters\n");
+ talloc_free(tbf);
+ return NULL;
+ }
llist_add(&tbf->list(), &bts->bts->ul_tbfs());
tbf->bts->tbf_ul_created();
@@ -930,8 +939,18 @@
if (tbf->is_egprs_enabled()) {
tbf->egprs_calc_window_size();
tbf->m_dl_egprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_egprs_ctrg_desc, 0);
+ if (!tbf->m_dl_egprs_ctrs) {
+ LOGP(DRLCMAC, LOGL_ERROR, "Couldn't allocate EGPRS DL counters\n");
+ talloc_free(tbf);
+ return NULL;
+ }
} else {
tbf->m_dl_gprs_ctrs = rate_ctr_group_alloc(tbf, &tbf_dl_gprs_ctrg_desc, 0);
+ if (!tbf->m_dl_gprs_ctrs) {
+ LOGP(DRLCMAC, LOGL_ERROR, "Couldn't allocate GPRS DL counters\n");
+ talloc_free(tbf);
+ return NULL;
+ }
}
llist_add(&tbf->list(), &bts->bts->dl_tbfs());
@@ -1439,6 +1458,11 @@
&tbf_ul_egprs_ctrg_desc, 0);
ul_tbf->m_ul_gprs_ctrs = rate_ctr_group_alloc(ul_tbf,
&tbf_ul_gprs_ctrg_desc, 0);
+ if (!ul_tbf->m_ctrs || !ul_tbf->m_ul_egprs_ctrs || !ul_tbf->m_ul_gprs_ctrs) {
+ LOGP(DRLCMAC, LOGL_ERROR, "Cound not allocate TBF UL rate counters\n");
+ talloc_free(ul_tbf);
+ return NULL;
+ }
return ul_tbf;
}
--
To view, visit https://gerrit.osmocom.org/3183
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Id6d780c67b4af15aaa5c6f2b8b00f2a0b70a7385
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>