RE: [EXTERNAL] Re: [PATCH net] hv_netvsc: Switch VF namespace in netvsc_open instead
From: Haiyang Zhang <haiyangz@microsoft.com>
Date: 2025-07-15 15:49:55
Also in:
linux-hyperv, lkml, stable
-----Original Message----- From: Jakub Kicinski <kuba@kernel.org> Sent: Monday, July 14, 2025 9:29 PM To: Haiyang Zhang <redacted> Cc: linux-hyperv@vger.kernel.org; netdev@vger.kernel.org; Haiyang Zhang [off-list ref]; KY Srinivasan [off-list ref]; wei.liu@kernel.org; Dexuan Cui [off-list ref]; edumazet@google.com; pabeni@redhat.com; stephen@networkplumber.org; davem@davemloft.net; linux- kernel@vger.kernel.org; stable@vger.kernel.org Subject: [EXTERNAL] Re: [PATCH net] hv_netvsc: Switch VF namespace in netvsc_open instead On Fri, 11 Jul 2025 13:57:10 -0700 Haiyang Zhang wrote:quoted
The existing code move the VF NIC to new namespace when NETDEV_REGISTERisquoted
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 willcausequoted
the default_device_exit_net() >> for_each_netdev_safe loop unable todetectquoted
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?
netvsc_event_set_vf_ns() moves the VF to default ns before the netns dismantle loop got to it, and causes the Null prt error.
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?
This patch reverts the 4c262801ea60, and moves the logic to netvsc_open(). I was thinking some other ways too... But seems I couldn't find a way to know it's in the for_each_netdev_safe loop, and to skip moving the VF in netvsc_event_set_vf_ns() this case. Thanks, - Haiyang