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

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

commit be17bf2f86aedecc0c33ceb78926f244025b0685
Author: wangchen <[email protected]>
AuthorDate: Thu Sep 26 15:05:17 2024 +0800

    net:when work_cancel_sync is excuted,it releases net_lock
    
    the modification is to solve the deadlock caused by work cancel not 
releasing netlock
    
    Signed-off-by: wangchen <[email protected]>
---
 net/igmp/igmp_group.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/igmp/igmp_group.c b/net/igmp/igmp_group.c
index b84c085b8a..9266c6700b 100644
--- a/net/igmp/igmp_group.c
+++ b/net/igmp/igmp_group.c
@@ -67,6 +67,7 @@
 
 #include "devif/devif.h"
 #include "igmp/igmp.h"
+#include "utils/utils.h"
 
 #ifdef CONFIG_NET_IGMP
 
@@ -212,6 +213,9 @@ FAR struct igmp_group_s *igmp_grpallocfind(FAR struct 
net_driver_s *dev,
 void igmp_grpfree(FAR struct net_driver_s *dev,
                   FAR struct igmp_group_s *group)
 {
+  unsigned int count;
+  int blresult;
+
   grpinfo("Free: %p flags: %02x\n", group, group->flags);
 
   /* Cancel the wdog */
@@ -220,7 +224,12 @@ void igmp_grpfree(FAR struct net_driver_s *dev,
 
   /* Cancel the workqueue */
 
+  blresult = net_breaklock(&count);
   work_cancel_sync(LPWORK, &group->work);
+  if (blresult >= 0)
+    {
+      net_restorelock(count);
+    }
 
   /* Remove the group structure from the group list in the device structure */
 

Reply via email to