platform: keep udev-device in udev_device_added() even if there is no netlink object

Throwing away the udev_device instance is wrong. There are two cases:

- the udev-device appears, and the netlink object will never appear
  (or is already gone). In this case, keeping the udev-device is ok
  because we will eventually get a signal from UDev to cleanup the
  device instance.

- the udev-device appears before the netlink object. In this case we
  want to keep the udev instance to have it ready.

Fixes: 388b7830f3
This commit is contained in:
Thomas Haller 2015-05-04 17:22:00 +02:00
parent f851a741a6
commit 7572837375

View file

@ -4439,15 +4439,15 @@ udev_device_added (NMPlatform *platform,
return;
}
rtnllink = rtnl_link_get (priv->link_cache, ifindex);
if (!rtnllink) {
warning ("(%s): udev-add: interface not known via netlink; ignoring...", ifname);
return;
}
g_hash_table_insert (priv->udev_devices, GINT_TO_POINTER (ifindex),
g_object_ref (udev_device));
rtnllink = rtnl_link_get (priv->link_cache, ifindex);
if (!rtnllink) {
debug ("(%s): udev-add: interface not known via netlink; ignoring ifindex %d...", ifname, ifindex);
return;
}
announce_object (platform, (struct nl_object *) rtnllink, NM_PLATFORM_SIGNAL_CHANGED, NM_PLATFORM_REASON_EXTERNAL);
}