From 904d05d4c4a5520a905a15fba9d8d4d9cd6f8863 Mon Sep 17 00:00:00 2001 From: faluco Date: Wed, 20 Oct 2021 17:42:11 +0200 Subject: [PATCH] Fix data race in bsr_proc::print_state(). While there, early exit if the log info channel is disabled to avoid formatting a string that will not be used. --- srsue/src/stack/mac/proc_bsr.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/srsue/src/stack/mac/proc_bsr.cc b/srsue/src/stack/mac/proc_bsr.cc index 4ac7a688b..6ebef5427 100644 --- a/srsue/src/stack/mac/proc_bsr.cc +++ b/srsue/src/stack/mac/proc_bsr.cc @@ -41,6 +41,12 @@ void bsr_proc::init(sr_proc* sr_, rlc_interface_mac* rlc_, srsran::ext_task_sche void bsr_proc::print_state() { + if (!logger.info.enabled()) { + return; + } + + std::lock_guard lock(mutex); + char str[128]; str[0] = '\0'; int n = 0;