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

linguini1 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git


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

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