From 6a19a19f001185df26d71cc6d58876fb6240d9e8 Mon Sep 17 00:00:00 2001 From: Ismael Gomez Date: Tue, 26 May 2020 13:30:54 +0200 Subject: [PATCH] Fix memory fault during exiting and waiting for worker --- srsenb/src/phy/phy.cc | 6 ++++-- srsue/src/phy/phy.cc | 12 ++++++++---- srsue/src/phy/sync.cc | 6 ++++-- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/srsenb/src/phy/phy.cc b/srsenb/src/phy/phy.cc index 6a061dcc9..c5155d485 100644 --- a/srsenb/src/phy/phy.cc +++ b/srsenb/src/phy/phy.cc @@ -174,8 +174,10 @@ void phy::rem_rnti(uint16_t rnti) // Remove the RNTI when the TTI finishes, this has a delay up to the pipeline length (3 ms) for (uint32_t i = 0; i < nof_workers; i++) { sf_worker* w = (sf_worker*)workers_pool.wait_worker_id(i); - w->rem_rnti(rnti); - w->release(); + if (w) { + w->rem_rnti(rnti); + w->release(); + } } if (SRSLTE_RNTI_ISUSER(rnti)) { workers_common.ue_db.rem_rnti(rnti); diff --git a/srsue/src/phy/phy.cc b/srsue/src/phy/phy.cc index 739fd4556..7206af63e 100644 --- a/srsue/src/phy/phy.cc +++ b/srsue/src/phy/phy.cc @@ -390,8 +390,10 @@ void phy::set_crnti(uint16_t rnti) // set_crnti() is an operation that takes time, apply asynrhonously with processing for (uint32_t i = 0; i < nof_workers; i++) { sf_worker* w = (sf_worker*)workers_pool.wait_worker_id(i); - w->set_crnti(rnti); - w->release(); + if (w) { + w->set_crnti(rnti); + w->release(); + } } } @@ -429,8 +431,10 @@ void phy::set_config(srslte::phy_cfg_t& config_, uint32_t cc_idx, uint32_t earfc if (cell_info) { // set_cell() is an operation that takes time, apply asynrhonously with processing sf_worker* w = (sf_worker*)workers_pool.wait_worker_id(i); - w->set_cell(cc_idx, *cell_info); - w->release(); + if (w) { + w->set_cell(cc_idx, *cell_info); + w->release(); + } } // set_config() is just a memcpy workers[i]->set_config(cc_idx, config_); diff --git a/srsue/src/phy/sync.cc b/srsue/src/phy/sync.cc index 6deef6c02..4dc1f8195 100644 --- a/srsue/src/phy/sync.cc +++ b/srsue/src/phy/sync.cc @@ -708,8 +708,10 @@ bool sync::set_cell(float cfo) bool success = true; for (uint32_t i = 0; i < workers_pool->get_nof_workers(); i++) { sf_worker* w = (sf_worker*)workers_pool->wait_worker_id(i); - success &= w->set_cell(0, cell); - w->release(); + if (w) { + success &= w->set_cell(0, cell); + w->release(); + } } if (!success) { Error("SYNC: Setting cell: initiating PHCH worker\n");