Re: [PATCH net] net: core: Fix the loop in default_device_exit_net()
From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2025-07-19 20:47:49
Also in:
linux-hyperv, lkml
From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2025-07-19 20:47:49
Also in:
linux-hyperv, lkml
On Fri, Jul 18, 2025 at 4:37 PM Jakub Kicinski [off-list ref] wrote:
On Fri, 18 Jul 2025 13:20:14 -0700 Haiyang Zhang wrote:quoted
The loop in default_device_exit_net() won't be able to properly detect the head then stop, and will hit NULL pointer, when a driver, like hv_netvsc, automatically moves the slave device together with the master device. To fix this, add a helper function to return the first migratable netdev correctly, no matter one or two devices were removed from this net's list in the last iteration.FTR I think that what the driver is trying to do is way too hacky, and it should be fixed instead. But I defer to Kuniyuki for the final word, maybe this change is useful for other reasons..
I agree that it should be fixed on the driver side. I don't think of a good reason for the change.