Adding the same device to an interface again led to a call chain that ended
up removing the device again through device callbacks.
Fix this by only toggling the interface available status when the device is
still the same.
Signed-off-by: Felix Fietkau <nbd@nbd.name>
{
struct device *mdev = iface->main_dev.dev;
- if (mdev == dev && iface->state == IFS_UP)
+ if (mdev == dev) {
+ if (iface->state != IFS_UP) {
+ interface_set_available(iface, false);
+ if (dev->present)
+ interface_set_available(iface, true);
+ }
return 0;
+ }
if (iface->main_dev.hotplug)
interface_set_main_dev(iface, NULL);