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

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

commit 9228568b16cb142b10143e9a5cc9df4fd04d79ed
Author: liangchaozhong <[email protected]>
AuthorDate: Thu Mar 26 20:35:01 2026 +0800

    drivers/usrsock/usrsock_rpmsg: release the tx buffer when the copy fails
    
    usrsock_request() kept the tx buffer it had just taken when
    usrsock_iovec_get() failed. Release it before returning the error.
    
    Also cast the ssize_t result of usrsock_iovec_get() to int explicitly;
    it never exceeds the tx buffer size.
    
    Signed-off-by: liangchaozhong <[email protected]>
    Signed-off-by: Bowen Wang <[email protected]>
---
 drivers/usrsock/usrsock_rpmsg.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/usrsock/usrsock_rpmsg.c b/drivers/usrsock/usrsock_rpmsg.c
index eb3b0323148..08ebb8c6d73 100644
--- a/drivers/usrsock/usrsock_rpmsg.c
+++ b/drivers/usrsock/usrsock_rpmsg.c
@@ -222,9 +222,10 @@ int usrsock_request(FAR struct iovec *iov, unsigned int 
iovcnt)
           break;
         }
 
-      ret = usrsock_iovec_get(buf, len, iov, iovcnt, pos, &done);
+      ret = (int)usrsock_iovec_get(buf, len, iov, iovcnt, pos, &done);
       if (ret < 0)
         {
+          rpmsg_release_tx_buffer(&priv->ept, buf);
           break;
         }
 

Reply via email to