On Fri, 11 Jul 2025 13:57:10 -0700 Haiyang Zhang wrote:
The existing code move the VF NIC to new namespace when NETDEV_REGISTER is received on netvsc NIC. During deletion of the namespace, default_device_exit_batch() >> default_device_exit_net() is called. When netvsc NIC is moved back and registered to the default namespace, it automatically brings VF NIC back to the default namespace. This will cause the default_device_exit_net() >> for_each_netdev_safe loop unable to detect the list end, and hit NULL ptr:
Are you saying that when netns is dismantled both devices are listed for moving back to default, but the netvsc_event_set_vf_ns() logic tries to undo the move / move the VF before the netns dismantle loop got to it?
This needs a better fix, moving on open is way too hacky. Perhaps we should start with reverting 4c262801ea60 and then trying to implement it in a more robust way?