You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2019/06/20 06:18:35 UTC

[mynewt-core] branch master updated: [console] fix race condition in rtt_console_write_ch (#1889)

This is an automated email from the ASF dual-hosted git repository.

vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git


The following commit(s) were added to refs/heads/master by this push:
     new 31244a0  [console] fix race condition in rtt_console_write_ch (#1889)
31244a0 is described below

commit 31244a01d062594e76f0062f28ac930d8e94212c
Author: Saul Pwanson <sa...@cionic.com>
AuthorDate: Wed Jun 19 23:18:30 2019 -0700

    [console] fix race condition in rtt_console_write_ch (#1889)
    
    - if multiple tasks write to rtt console when it is not present,
    rtt_console_retries_left can be decremented below zero, leading to
    near-infinite retry.  This blocks the calling task for a few years.
---
 sys/console/full/src/rtt_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/console/full/src/rtt_console.c b/sys/console/full/src/rtt_console.c
index 7daef86..0b25157 100644
--- a/sys/console/full/src/rtt_console.c
+++ b/sys/console/full/src/rtt_console.c
@@ -78,7 +78,7 @@ rtt_console_write_ch(char c)
             break;
         }
 
-        if (!rtt_console_retries_left) {
+        if (rtt_console_retries_left <= 0) {
             break;
         }