b75568ba24
- dispatcher: fix crash on exit while logging from signal handler (rh #1017884) - core: workaround crash when connecting to wifi (rh #1025371) - ethernet: don't crash if device doesn't have a MAC address (rh #1029053) - libnm-glib: fix crash by taking additional ref in result_cb() (rh #1030403) - ifcfg-rh: fix ignoring updates that don't change anything
93 lines
3.5 KiB
Diff
93 lines
3.5 KiB
Diff
From 788eed99de51cd35adeb6585379b5e920c79b3f3 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Haller <thaller@redhat.com>
|
|
Date: Fri, 1 Nov 2013 10:32:27 +0100
|
|
Subject: [PATCH] core: workaround crash when connecting to wifi (rh #1025371)
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
rh #1025371 reports a crash in handle_ip_config_timeout() because
|
|
nm_device_wifi_get_activation_ap() did not return any access point.
|
|
|
|
The handling of the AP in nm-device-wifi.c should be reworked and soon
|
|
will be fixed. For now, play it safe, and try to cope with any cases
|
|
where nm_device_wifi_get_activation_ap() might return NULL.
|
|
|
|
Later, this patch should be reverted and handling of the AP properly
|
|
cleaned up.
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1025371
|
|
|
|
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
|
|
---
|
|
src/devices/nm-device-wifi.c | 16 +++++++++-------
|
|
1 file changed, 9 insertions(+), 7 deletions(-)
|
|
|
|
diff --git a/src/devices/nm-device-wifi.c b/src/devices/nm-device-wifi.c
|
|
index 855c1e7..6c19d62 100644
|
|
--- a/src/devices/nm-device-wifi.c
|
|
+++ b/src/devices/nm-device-wifi.c
|
|
@@ -2313,7 +2313,7 @@ supplicant_iface_state_cb (NMSupplicantInterface *iface,
|
|
*/
|
|
if (devstate == NM_DEVICE_STATE_CONFIG) {
|
|
NMAccessPoint *ap = nm_device_wifi_get_activation_ap (self);
|
|
- const GByteArray *ssid = nm_ap_get_ssid (ap);
|
|
+ const GByteArray *ssid = ap ? nm_ap_get_ssid (ap) : NULL;
|
|
|
|
nm_log_info (LOGD_DEVICE | LOGD_WIFI,
|
|
"Activation (%s/wireless) Stage 2 of 5 (Device Configure) "
|
|
@@ -2593,9 +2593,8 @@ supplicant_connection_timeout_cb (gpointer user_data)
|
|
|
|
g_assert (priv->mode == NM_802_11_MODE_INFRA);
|
|
ap = nm_device_wifi_get_activation_ap (self);
|
|
- g_assert (ap);
|
|
|
|
- if (priv->ssid_found && is_encrypted (ap, connection)) {
|
|
+ if (priv->ssid_found && ap && is_encrypted (ap, connection)) {
|
|
guint64 timestamp = 0;
|
|
gboolean new_secrets = TRUE;
|
|
|
|
@@ -2944,7 +2943,11 @@ act_stage2_config (NMDevice *dev, NMDeviceStateReason *reason)
|
|
g_assert (req);
|
|
|
|
ap = nm_device_wifi_get_activation_ap (self);
|
|
- g_assert (ap);
|
|
+ if (!ap) {
|
|
+ nm_log_warn (LOGD_DEVICE | LOGD_WIFI, "act_stage2_config failed due to unexpected missing activation_ap. Abort");
|
|
+ *reason = NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT;
|
|
+ goto out;
|
|
+ }
|
|
|
|
connection = nm_act_request_get_connection (req);
|
|
g_assert (connection);
|
|
@@ -3102,7 +3105,6 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
|
}
|
|
|
|
ap = nm_device_wifi_get_activation_ap (self);
|
|
- g_assert (ap);
|
|
|
|
/* If IP configuration times out and it's a static WEP connection, that
|
|
* usually means the WEP key is wrong. WEP's Open System auth mode has
|
|
@@ -3111,7 +3113,7 @@ handle_ip_config_timeout (NMDeviceWifi *self,
|
|
* types (open, WPA, 802.1x, etc) if the secrets/certs were wrong the
|
|
* connection would have failed before IP configuration.
|
|
*/
|
|
- if (is_static_wep (ap, connection) && (may_fail == FALSE)) {
|
|
+ if (ap && is_static_wep (ap, connection) && (may_fail == FALSE)) {
|
|
/* Activation failed, we must have bad encryption key */
|
|
nm_log_warn (LOGD_DEVICE | LOGD_WIFI,
|
|
"Activation (%s/wireless): could not get IP configuration for "
|
|
@@ -3203,7 +3205,7 @@ activation_success_handler (NMDevice *dev)
|
|
/* If the AP isn't fake, it was found in the scan list and all its
|
|
* details are known.
|
|
*/
|
|
- if (!nm_ap_get_fake (ap))
|
|
+ if (!ap || !nm_ap_get_fake (ap))
|
|
goto done;
|
|
|
|
/* If the activate AP was fake, it probably won't have a BSSID at all.
|
|
--
|
|
1.7.11.7
|
|
|