mirror of
https://github.com/apache/nuttx.git
synced 2026-08-01 20:28:58 +00:00
netdev_upperhalf.c: add net_lock when vlan_foreach
avoid illegal address access caused by removing vlan network cards during the traversal of vlan network cards Signed-off-by: zhanghongyu <zhanghongyu@xiaomi.com>
This commit is contained in:
parent
00dfb5d1f3
commit
4f7e03db2e
1 changed files with 3 additions and 0 deletions
|
|
@ -483,6 +483,7 @@ netdev_upper_vlan_foreach(FAR struct netdev_upperhalf_s *upper,
|
|||
{
|
||||
int i;
|
||||
|
||||
net_lock();
|
||||
for (i = 0; i < CONFIG_NET_VLAN_COUNT; i++)
|
||||
{
|
||||
if (upper->vlan[i].dev)
|
||||
|
|
@ -490,6 +491,8 @@ netdev_upper_vlan_foreach(FAR struct netdev_upperhalf_s *upper,
|
|||
cb(upper->vlan[i].dev);
|
||||
}
|
||||
}
|
||||
|
||||
net_unlock();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue