mirror of
https://github.com/apache/nuttx.git
synced 2026-05-13 02:18:38 +08: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:
committed by
Alan C. Assis
parent
00dfb5d1f3
commit
4f7e03db2e
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user