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

jerpelea 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 a7926405ca net/udp: Fix the bug of overwriting when the udp recv 
buffer is full
a7926405ca is described below

commit a7926405cafca178e137fbae05290c0f8a38cd51
Author: wangyingdong <wangyingd...@xiaomi.com>
AuthorDate: Thu Jun 8 10:50:53 2023 +0800

    net/udp: Fix the bug of overwriting when the udp recv buffer is full
    
    Signed-off-by: wangyingdong <wangyingd...@xiaomi.com>
---
 net/udp/udp_callback.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/net/udp/udp_callback.c b/net/udp/udp_callback.c
index f353bb32b1..6ccf330cd2 100644
--- a/net/udp/udp_callback.c
+++ b/net/udp/udp_callback.c
@@ -75,13 +75,13 @@ static uint16_t udp_datahandler(FAR struct net_driver_s 
*dev,
   uint8_t offset = 0;
 
 #if CONFIG_NET_RECV_BUFSIZE > 0
-  while (iob_get_queue_size(&conn->readahead) > conn->rcvbufs)
+  if (iob_get_queue_size(&conn->readahead) > conn->rcvbufs)
     {
-      iob = iob_remove_queue(&conn->readahead);
-      iob_free_chain(iob);
+      netdev_iob_release(dev);
 #ifdef CONFIG_NET_STATISTICS
       g_netstats.udp.drop++;
 #endif
+      return 0;
     }
 #endif
 

Reply via email to