Skip to content
Permalink
Browse files

logging: Fix corruption in log panic when scheduler was active

Logger had false assumption that once log_panic is called then
context switch will never occur and was not protecting against
reentrancy in panic mode. Added interrupt locking when accessing
unprotected part.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
  • Loading branch information...
nordic-krch authored and ioannisg committed Jul 3, 2019
1 parent 74da439 commit 09993873bdf2f461bc519bc0ad6a61a9a63efc26
Showing with 2 additions and 0 deletions.
  1. +2 −0 subsys/logging/log_core.c
@@ -204,7 +204,9 @@ static inline void msg_finalize(struct log_msg *msg,
irq_unlock(key);

if (panic_mode) {
key = irq_lock();
(void)log_process(false);
irq_unlock(key);
} else if (CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD) {
if ((buffered_cnt == CONFIG_LOG_PROCESS_TRIGGER_THRESHOLD) &&
(proc_tid != NULL)) {

0 comments on commit 0999387

Please sign in to comment.
You can’t perform that action at this time.