summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2015-07-31 18:06:43 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2015-08-20 08:52:18 +0200
commitb557f91a1bca67b05f69185f244319e764a4a21d (patch)
tree258f4d5f7012e94b9c012ffdfc29ecee660f7704
parent9a79398a00883716afab1a525bb30542279bedf9 (diff)
downloadNetworkManager-b557f91a1bca67b05f69185f244319e764a4a21d.tar.gz
device: don't clear @master on cleanup when the link is still enslaved
Don't clear NMDevice @master in nm_device_cleanup() if the device link is still enslaved because this causes an inconsistent state in which the slave in included in the @slaves field of master device but @master of slave device is NULL. In such state, if the master link gets deleted, NM receives a change event for each slave and a deletion event for the master; the change events should also remove slaves from @slaves of master device, but since their @master field is NULL the removal can't be performed. Later, when the master deletion event is received, @slaves is not empty in dispose() of NMDevice and the following assertion is triggered: dispose: runtime check failed: (priv->slaves == NULL) https://bugzilla.redhat.com/show_bug.cgi?id=1243371
-rw-r--r--src/devices/nm-device.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 93b5e35bb0..6fe324c160 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8205,9 +8205,11 @@ nm_device_cleanup (NMDevice *self, NMDeviceStateReason reason, CleanupType clean
nm_device_master_release_slaves (self);
/* slave: mark no longer enslaved */
- g_clear_object (&priv->master);
- priv->enslaved = FALSE;
- g_object_notify (G_OBJECT (self), NM_DEVICE_MASTER);
+ if (nm_platform_link_get_master (NM_PLATFORM_GET, priv->ifindex) <= 0) {
+ g_clear_object (&priv->master);
+ priv->enslaved = FALSE;
+ g_object_notify (G_OBJECT (self), NM_DEVICE_MASTER);
+ }
/* Take out any entries in the routing table and any IP address the device had. */
ifindex = nm_device_get_ip_ifindex (self);