summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2018-01-11 11:15:40 +0100
committerThomas Haller <thaller@redhat.com>2018-02-21 20:28:46 +0100
commit2ea8e1029fc3a4f51e240ea4b90a74f5031a608b (patch)
tree9266946dc76e7f35b9a00cc9753ffb97f77cffbd
parenta169d689babd350b1c48e7397ffbf23447849b22 (diff)
downloadNetworkManager-2ea8e1029fc3a4f51e240ea4b90a74f5031a608b.tar.gz
bluetooth: fail activation when setting unknown ip-iface
-rw-r--r--src/devices/bluetooth/nm-device-bt.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c
index 977c1e1ae6..c61736d3c7 100644
--- a/src/devices/bluetooth/nm-device-bt.c
+++ b/src/devices/bluetooth/nm-device-bt.c
@@ -753,7 +753,7 @@ bluez_connect_cb (GObject *object,
GAsyncResult *res,
void *user_data)
{
- NMDeviceBt *self = NM_DEVICE_BT (user_data);
+ gs_unref_object NMDeviceBt *self = NM_DEVICE_BT (user_data);
NMDeviceBtPrivate *priv = NM_DEVICE_BT_GET_PRIVATE (self);
GError *error = NULL;
const char *device;
@@ -761,6 +761,9 @@ bluez_connect_cb (GObject *object,
device = nm_bluez_device_connect_finish (NM_BLUEZ_DEVICE (object),
res, &error);
+ if (!nm_device_is_activating (NM_DEVICE (self)))
+ return;
+
if (!device) {
_LOGW (LOGD_BT, "Error connecting with bluez: %s", error->message);
g_clear_error (&error);
@@ -768,7 +771,6 @@ bluez_connect_cb (GObject *object,
nm_device_state_changed (NM_DEVICE (self),
NM_DEVICE_STATE_FAILED,
NM_DEVICE_STATE_REASON_BT_FAILED);
- g_object_unref (self);
return;
}
@@ -776,7 +778,13 @@ bluez_connect_cb (GObject *object,
g_free (priv->rfcomm_iface);
priv->rfcomm_iface = g_strdup (device);
} else if (priv->bt_type == NM_BT_CAPABILITY_NAP) {
- nm_device_set_ip_iface (NM_DEVICE (self), device);
+ if (!nm_device_set_ip_iface (NM_DEVICE (self), device)) {
+ _LOGW (LOGD_BT, "Error connecting with bluez: cannot find device %s", device);
+ nm_device_state_changed (NM_DEVICE (self),
+ NM_DEVICE_STATE_FAILED,
+ NM_DEVICE_STATE_REASON_BT_FAILED);
+ return;
+ }
}
_LOGD (LOGD_BT, "connect request successful");
@@ -784,7 +792,6 @@ bluez_connect_cb (GObject *object,
/* Stage 3 gets scheduled when Bluez says we're connected */
priv->have_iface = TRUE;
check_connect_continue (self);
- g_object_unref (self);
}
static void