diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-09-02 16:47:59 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-09-03 09:00:44 +0200 |
commit | eec6951949022cbe965b6fce133e442939283582 (patch) | |
tree | 31753c399f750a560b1a04ca202731f104c3b0fd | |
parent | 74a7626940b3ac0e7439681c5fc032896b511e3f (diff) | |
download | NetworkManager-eec6951949022cbe965b6fce133e442939283582.tar.gz |
device: fix crash when master connection fails
When the master AC becomes ready, activate_stage1_device_prepare() is
called in a idle handler. If the master AC fails in the meantime, it
will change state to deactivating or deactivated. We must check for
that condition before proceeding with slave activation. Note the the
'master_ready' flag of an AC is never cleared after it is set.
Fixes: 5b677d5a3bed ('device: move check for master from nm_device_activate_schedule_stage2_device_config() to end of stage1')
https://bugzilla.redhat.com/show_bug.cgi?id=1747998
-rw-r--r-- | src/devices/nm-device.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 0872f5a6e2..5310290743 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -6596,13 +6596,13 @@ activate_stage1_device_prepare (NMDevice *self) active = NM_ACTIVE_CONNECTION (priv->act_request.obj); master = nm_active_connection_get_master (active); if (master) { + if (nm_active_connection_get_state (master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { + _LOGD (LOGD_DEVICE, "master connection is deactivating"); + nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); + return; + } /* If the master connection is ready for slaves, attach ourselves */ if (!nm_active_connection_get_master_ready (active)) { - if (nm_active_connection_get_state (master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { - _LOGD (LOGD_DEVICE, "master connection is deactivating"); - nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED); - return; - } if (priv->master_ready_id == 0) { _LOGD (LOGD_DEVICE, "waiting for master connection to become ready"); priv->master_ready_id = g_signal_connect (active, |