From e93bdfe0899af79467af3f3c360ac9ea1b73652c Mon Sep 17 00:00:00 2001 From: zhanghongyu Date: Wed, 12 Jul 2023 20:05:25 +0800 Subject: [PATCH] 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 --- 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)