michallenc opened a new issue, #19173:
URL: https://github.com/apache/nuttx/issues/19173

   ### Description / Steps to reproduce the issue
   
   ## Description
   
   When using multiple channels for syslog output (for example, combining the 
NSH console, USB CDCACM, and/or logging to 
   a file stored in NOR flash memory), an infinite loop (cyclical syslog 
output) can occur. 
   
   This issue happens because the functions `syslograwstream_addstring` and 
`syslograwstream_addchar` do not check and handle the return value of 
`syslograwstream_flush`. 
   
   The `syslograwstream_flush` function can return a negative `errno` 
propagated from `syslog_write` -> `syslog_write_foreach` -> `write`. 
   This typically happens if a write operation to the syslog file fails, or 
when the USB CDCACM interface for syslog is disconnected.
   
   ## Affected files
    * `libs/libc/stream/lib_syslograwstream.c`
    * `drivers/syslog/syslog_write.c`
   
   ## Possible Solution
   
   The solution would be to properly handle the return value from 
`syslograwstream_flush` to prevent the infinite loop when a errno occurs. 
   Please see the attached patch for more details.
   
   Issue reported by Martin Krasula, forwarding to Github.
   
   ### On which OS does this issue occur?
   
   [OS: Other], [OS: Linux], [OS: Windows], [OS: Mac], [OS: BSD]
   
   ### What is the version of your OS?
   
   NuttX
   
   ### NuttX Version
   
   master
   
   ### Issue Architecture
   
   [Arch: all]
   
   ### Issue Area
   
   [Area: OS Components]
   
   ### Host information
   
   _No response_
   
   ### Verification
   
   - [x] I have verified before submitting the report.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to