From 0876332bae2afefa4d0fdfac014d7ab6e1d357a0 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Fri, 15 Jun 2018 06:30:35 +0200 Subject: [PATCH] iwd: in prepare stage check that matching AP exists Check the return value of nm_wifi_aps_find_first_compatible in act_stage1_prepare. Also a small formatting fix. --- src/devices/wifi/nm-device-iwd.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index 33ee955453..2b04a9e5a0 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -1219,15 +1219,13 @@ act_stage1_prepare (NMDevice *device, NMDeviceStateReason *out_failure_reason) ap = ap_path ? nm_wifi_ap_lookup_for_device (NM_DEVICE (self), ap_path) : NULL; if (!ap) { ap = nm_wifi_aps_find_first_compatible (&priv->aps_lst_head, connection); - - /* TODO: assuming hidden networks aren't supported do we need - * to consider the case of APs that are not in the scan list - * yet, for which nm-device-wifi.c creates the temporary fake - * AP object? - */ + if (!ap) { + NM_SET_OUT (out_failure_reason, NM_DEVICE_STATE_REASON_CONFIG_FAILED); + return NM_ACT_STAGE_RETURN_FAILURE; + } nm_active_connection_set_specific_object (NM_ACTIVE_CONNECTION (req), - nm_dbus_object_get_path (NM_DBUS_OBJECT (ap))); + nm_dbus_object_get_path (NM_DBUS_OBJECT (ap))); } set_current_ap (self, ap, FALSE);