raiden00pl opened a new pull request, #19752:
URL: https://github.com/apache/nuttx/pull/19752

   ## Summary
   
   cdcacm_sndpacket() runs from task context and from the bulk IN completion 
callback, which may be interrupt context.  cdcuart_dmasend() advances the xmit 
tail non-atomically, so a completion arriving mid setup re-sends the same 
region and advances the tail past the head, re-transmitting a ring of stale 
data.
   
   c497c5feb0 dropped the critical section that used to cover this. Restore it 
with priv->lock held across the setup and EP_SUBMIT; the submit must stay 
inside to keep request order.  cdcuart_dmasend() now runs with the lock held, 
so its own acquisition is removed.
   
   The race needs the writer to keep the ring non-empty across completions, so 
it only appears at high sustained write rates.  On nRF52840, 131072-byte writes 
were received as ~147600 bytes - one extra CDCACM_TXBUFSIZE of stale data per 
hit.  With this change the host receives exactly what was sent.
   
   ## Impact
   
   fix bug occurring at high TX rates. This bug may not be observable with the 
current upstream because the serial driver is the bottleneck. After optimizing 
the serial driver, the error begins to appear.
   
   ## Testing
   
   Nordic Power Profiler Kit 2 with high data stream


-- 
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