Re: [PR] mld: free all mld group when netdev unregister [nuttx]

2025-12-25 Thread via GitHub


acassis merged PR #17671:
URL: https://github.com/apache/nuttx/pull/17671


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



[PR] mld: free all mld group when netdev unregister [nuttx]

2025-12-24 Thread via GitHub


zhhyu7 opened a new pull request, #17671:
URL: https://github.com/apache/nuttx/pull/17671

   ## Summary
   otherwise, if the mld timers are not cancelled, an illegal address will be 
accessed after timeout. to avoid this scenario, when the network card is 
unregistered, all MLD timers must be attempted to be synchronously cancelled.
   
   ## Impact
   network device.
   ## Testing
   sim:matter with code change:
   ```
   nuttx$ git diff arch/sim/src/sim/sim_netdriver.c
   diff --git a/arch/sim/src/sim/sim_netdriver.c 
b/arch/sim/src/sim/sim_netdriver.c
   index 4dfef8da682..a983ed3bf4b 100644
   --- a/arch/sim/src/sim/sim_netdriver.c
   +++ b/arch/sim/src/sim/sim_netdriver.c
   @@ -272,6 +272,15 @@ static void sim_netdev_interrupt(wdparm_t arg)
sim_netdev_interrupt, arg);
}

   +static struct work_s g_work;
   +static void sim_netdev_unregister_work(void *work)
   +{
   +  struct netdev_lowerhalf_s *dev = work;
   +
   +  netdev_lower_unregister(dev);
   +  memset(dev, 0, sizeof(struct netdev_lowerhalf_s));
   +}
   +

/
 * Public Functions
 
/
   @@ -310,8 +319,9 @@ int sim_netdriver_init(void)

  netdev_lower_register(dev, devidx < CONFIG_SIM_WIFIDEV_NUMBER ?
 NET_LL_IEEE80211 : NET_LL_ETHERNET);
   -  wd_start(&g_sim_dev[devidx].wdog, 0,
   -   sim_netdev_interrupt, (wdparm_t)&g_sim_dev[devidx]);
   +  // wd_start(&g_sim_dev[devidx].wdog, 0,
   +  //  sim_netdev_interrupt, (wdparm_t)&g_sim_dev[devidx]);
   +  work_queue(HPWORK, &g_work, sim_netdev_unregister_work, 
&g_sim_dev[devidx].dev, 50);
}

  return OK;
   ```
   log without this patch
   ```
   (gdb) r
   Starting program: /home/zhhyu/source/upstream/nuttx/nuttx 
   [Thread debugging using libthread_db enabled]
   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
   
   NuttShell (NSH) NuttX-12.11.0
   MOTD: username=admin password=Administrator
   nsh> 
   Program received signal SIGSEGV, Segmentation fault.
   0x40007b4e in wd_insert (wdog=0x73d33b80, expired=53, 
wdentry=0x4009df88 , arg=140737284092720) at 
wdog/wd_start.c:192
   192if (!clock_compare(curr->expired, expired))
   (gdb) 
   ```
   log with this patch
   ```
   (gdb) r
   Starting program: /home/zhhyu/source/upstream/nuttx/nuttx 
   [Thread debugging using libthread_db enabled]
   Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
   
   NuttShell (NSH) NuttX-12.11.0
   MOTD: username=admin password=Administrator
   nsh> ifconfig
IPv4  IPv6   TCP   UDP  ICMP ICMPv6 CAN
   Received   0003          
   Dropped    0003          
 IPv4VHL:    Frg: 
 IPv6VHL: 
 Checksum               
 TCP ACK:    SYN: 
 RST:   
 Type               
   Sent   000b        000b  
 Rexmit             
   nsh> 
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]