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:58:29 +0200
commit8482f060907acc1dfe66c73d046f8eba63dd35bd (patch)
tree0764adca903d651a241c3b50c0963caebfe80edf
parentad0ab5e827212f94788daa24b1952ea3f904e62f (diff)
downloadNetworkManager-8482f060907acc1dfe66c73d046f8eba63dd35bd.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 (cherry picked from commit b557f91a1bca67b05f69185f244319e764a4a21d)
-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 7fab9273b5..e52c68b460 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -8028,9 +8028,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);