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

xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git


The following commit(s) were added to refs/heads/releases/13.0 by this push:
     new e2f85ffea7c drivers/usbdev/cdcacm: fix self-deadlock in 
cdcuart_txempty()
e2f85ffea7c is described below

commit e2f85ffea7cb4396301ed759a320f28044c8f932
Author: Felipe Moura <[email protected]>
AuthorDate: Fri Aug 7 15:17:46 2026 -0300

    drivers/usbdev/cdcacm: fix self-deadlock in cdcuart_txempty()
    
    cdcuart_txempty() held priv->lock across EP_POLL(), which re-enters the
    class through cdcacm_wrcomplete() and takes that same non-recursive lock,
    and then took it a second time to read nwrq. Release it after the
    disconnected check, matching cdcuart_txready()/cdcuart_rxavailable().
    
    Fixes: cc067ab199bb ("drivers/usbdev/cdcacm.c: Use small lock to protect 
cdcacm")
    Signed-off-by: Felipe Moura <[email protected]>
---
 drivers/usbdev/cdcacm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usbdev/cdcacm.c b/drivers/usbdev/cdcacm.c
index 13dd496e62e..5b003218fb6 100644
--- a/drivers/usbdev/cdcacm.c
+++ b/drivers/usbdev/cdcacm.c
@@ -2945,6 +2945,8 @@ static bool cdcuart_txempty(FAR struct uart_dev_s *dev)
       return true;
     }
 
+  spin_unlock_irqrestore(&priv->lock, flags);
+
   priv->ispolling = true;
   EP_POLL(ep);
   priv->ispolling = false;

Reply via email to