You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ar...@apache.org on 2024/03/13 14:23:58 UTC

(nuttx) branch master updated: tun: in tun_write, try to release iob before iob_prepare

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

archer 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 e93bdfe089 tun: in tun_write, try to release iob before iob_prepare
e93bdfe089 is described below

commit e93bdfe0899af79467af3f3c360ac9ea1b73652c
Author: zhanghongyu <zh...@xiaomi.com>
AuthorDate: Wed Jul 12 20:05:25 2023 +0800

    tun: in tun_write, try to release iob before iob_prepare
    
    io_pktlen will incorrect when two packets are received in a row and the packet length decreases.
    
    Signed-off-by: zhanghongyu <zh...@xiaomi.com>
---
 drivers/net/tun.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index e4374185b9..43067cfb19 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -990,6 +990,7 @@ static ssize_t tun_write(FAR struct file *filep, FAR const char *buffer,
       if (priv->write_d_len == 0)
         {
           net_lock();
+          netdev_iob_release(&priv->dev);
           ret = netdev_iob_prepare(&priv->dev, false, 0);
           priv->dev.d_buf = NULL;
           if (ret < 0)