Commit eec69519 authored by Beniamino Galvani's avatar Beniamino Galvani

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: 5b677d5a ('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
parent 74a76269
Pipeline #60716 passed with stages
in 50 minutes and 40 seconds
......@@ -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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment