Blame SOURCES/1008-wifi-avoid-crash-due-to-incomplete-Wi-Fi-API-info-rh1866395.patch

f25c7b
From c71d29b3dbe13d6ce456200d9e8ce9d0739eb368 Mon Sep 17 00:00:00 2001
f25c7b
From: Thomas Haller <thaller@redhat.com>
f25c7b
Date: Mon, 3 Aug 2020 09:54:04 +0200
f25c7b
Subject: [PATCH 1/1] wifi: avoid crash due to incomplete Wi-Fi API info
f25c7b
f25c7b
In this case, GetAll failed with "Timeout was reached". We still
f25c7b
create a dummy BSS info, because we kept track of the object to
f25c7b
start with. That way, we don't simply want to ignore the failure,
f25c7b
because NMDeviceWifi might track this NMWifiAP already, and we may
f25c7b
need an update (even if we failed to fetch the requested information).
f25c7b
f25c7b
However, that later leads to a crash, because NMDeviceWifi expect the BSSID
f25c7b
present then.
f25c7b
f25c7b
Avoid that, by don't processing such APs.
f25c7b
f25c7b
    #0  g_logv (log_domain=0x7f2ac10a60a9 "NetworkManager", log_level=G_LOG_LEVEL_CRITICAL, format=<optimized out>, args=<optimized out>) at ../glib/gmessages.c:1377
f25c7b
    #1  0x00007f2acf152233 in g_log
f25c7b
        (log_domain=log_domain@entry=0x7f2ac10a60a9 "NetworkManager", log_level=log_level@entry=G_LOG_LEVEL_CRITICAL, format=format@entry=0x7f2acf1a46ff "%s: assertion '%s' failed")
f25c7b
        at ../glib/gmessages.c:1415
f25c7b
    #2  0x00007f2acf152a2d in g_return_if_fail_warning
f25c7b
        (log_domain=log_domain@entry=0x7f2ac10a60a9 "NetworkManager", pretty_function=pretty_function@entry=0x7f2ac10a9e70 <__func__.50> "try_fill_ssid_for_hidden_ap", expression=expression@entry=0x7f2ac10a86d0 "bssid") at ../glib/gmessages.c:2771
f25c7b
    #3  0x00007f2ac108a402 in try_fill_ssid_for_hidden_ap (ap=0x5569978b61c0 [NMWifiAP], self=0x55699786ea00 [NMDeviceWifi]) at src/devices/wifi/nm-device-wifi.c:1883
f25c7b
    #4  supplicant_iface_bss_changed_cb (iface=0x556997777260 [NMSupplicantInterface], bss_info=0x7f2ab4028f00, is_present=1, self=0x55699786ea00 [NMDeviceWifi])
f25c7b
        at src/devices/wifi/nm-device-wifi.c:1946
f25c7b
    #5  0x00007f2ace246af0 in ffi_call_unix64 () at ../src/x86/unix64.S:76
f25c7b
    #6  0x00007f2ace2462ab in ffi_call (cif=cif@entry=0x7ffd9c107c90, fn=fn@entry=0x7f2ac1089e80 <supplicant_iface_bss_changed_cb>, rvalue=<optimized out>, avalue=avalue@entry=0x7ffd9c107ba0)
f25c7b
        at ../src/x86/ffi64.c:525
f25c7b
    #7  0x00007f2acf23e87a in g_cclosure_marshal_generic_va
f25c7b
        (closure=<optimized out>, return_value=<optimized out>, instance=<optimized out>, args_list=<optimized out>, marshal_data=<optimized out>, n_params=<optimized out>, param_types=<optimized out>) at ../gobject/gclosure.c:1614
f25c7b
    #8  0x00007f2acf23dae6 in _g_closure_invoke_va
f25c7b
        (closure=closure@entry=0x5569978a0cc0, return_value=return_value@entry=0x0, instance=instance@entry=0x556997777260, args=args@entry=0x7ffd9c107f00, n_params=2, param_types=0x55699775b990) at ../gobject/gclosure.c:873
f25c7b
    #9  0x00007f2acf2566e9 in g_signal_emit_valist (instance=0x556997777260, signal_id=<optimized out>, detail=0, var_args=var_args@entry=0x7ffd9c107f00) at ../gobject/gsignal.c:3407
f25c7b
    #10 0x00007f2acf256c63 in g_signal_emit (instance=instance@entry=0x556997777260, signal_id=<optimized out>, detail=detail@entry=0) at ../gobject/gsignal.c:3554
f25c7b
    #11 0x00005569972ece61 in _bss_info_changed_emit (self=self@entry=0x556997777260 [NMSupplicantInterface], bss_info=bss_info@entry=0x7f2ab4028f00, is_present=is_present@entry=1)
f25c7b
        at src/supplicant/nm-supplicant-interface.c:555
f25c7b
    #12 0x00005569972ed3a0 in _bss_info_properties_changed (self=0x556997777260 [NMSupplicantInterface], bss_info=0x7f2ab4028f00, properties=<optimized out>, initial=<optimized out>)
f25c7b
        at src/supplicant/nm-supplicant-interface.c:758
f25c7b
    #13 0x00005569972f756b in _bss_info_get_all_cb (result=0x0, error=<optimized out>, user_data=0x7f2ab4028f00) at src/supplicant/nm-supplicant-interface.c:784
f25c7b
    #14 0x0000556997217bc1 in _nm_dbus_connection_call_default_cb (source=0x5569977480c0 [GDBusConnection], res=<optimized out>, user_data=user_data@entry=0x556997855d50)
f25c7b
        at shared/nm-glib-aux/nm-dbus-aux.c:74
f25c7b
    #15 0x00007f2acf339e4a in g_task_return_now (task=task@entry=0x7f2ab4003f00 [GTask]) at ../gio/gtask.c:1214
f25c7b
    #16 0x00007f2acf33aa3d in g_task_return (task=0x7f2ab4003f00 [GTask], type=<optimized out>) at ../gio/gtask.c:1283
f25c7b
    #17 0x00007f2acf33b4fe in g_task_return (type=G_TASK_RETURN_ERROR, task=<optimized out>) at ../gio/gtask.c:1861
f25c7b
    #18 g_task_return_error (task=<optimized out>, error=<optimized out>) at ../gio/gtask.c:1867
f25c7b
    #19 0x0000556997893f40 in  ()
f25c7b
    #20 0x3a85d39adfae7f00 in  ()
f25c7b
    #21 0x00007f2ab4003cc0 in  ()
f25c7b
    #22 0x00007f2acf396460 in g_dbus_connection_call_done () at ../gio/gdbusconnection.c:2059
f25c7b
    #23 0x00007f2ab4003f00 in  ()
f25c7b
    #24 0x0000000000000086 in  ()
f25c7b
    #25 0x0000000000000018 in  ()
f25c7b
    #26 0x00007f2acf339e4a in g_task_return_now (task=0x7f2ab4003f00 [GTask], task@entry=0x7f2ab4003cc0 [GTask]) at ../gio/gtask.c:1214
f25c7b
    #27 0x00007f2acf33aa3d in g_task_return (task=0x7f2ab4003cc0 [GTask], type=<optimized out>) at ../gio/gtask.c:1283
f25c7b
    #28 0x00007f2acf33b4fe in g_task_return (type=G_TASK_RETURN_ERROR, task=<optimized out>) at ../gio/gtask.c:1861
f25c7b
    #29 g_task_return_error (task=<optimized out>, error=<optimized out>) at ../gio/gtask.c:1867
f25c7b
    #30 0x0000003000000028 in  ()
f25c7b
    #31 0x00007ffd9c108290 in  ()
f25c7b
f25c7b
Fixes: b83f07916a54 ('supplicant: large rework of wpa_supplicant handling')
f25c7b
(cherry picked from commit 4d878d7012cd9dc031682ef5e5b025081427325b)
f25c7b
(cherry picked from commit 029d07b019ea6532fbf6f8db03efb648f0931625)
f25c7b
---
f25c7b
 src/devices/wifi/nm-device-wifi.c | 7 +++++++
f25c7b
 1 file changed, 7 insertions(+)
f25c7b
f25c7b
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
f25c7b
index 2d97f9b117a2..2a3428861737 100644
f25c7b
--- a/src/devices/wifi/nm-device-wifi.c
f25c7b
+++ b/src/devices/wifi/nm-device-wifi.c
f25c7b
@@ -1937,6 +1937,13 @@ supplicant_iface_bss_changed_cb (NMSupplicantInterface *iface,
f25c7b
 	} else {
f25c7b
 		gs_unref_object NMWifiAP *ap = NULL;
f25c7b
 
f25c7b
+		if (!bss_info->bssid_valid) {
f25c7b
+			/* We failed to initialize the info about the AP. This can
f25c7b
+			 * happen due to an error in the D-Bus communication. In this case
f25c7b
+			 * we ignore the info. */
f25c7b
+			return;
f25c7b
+		}
f25c7b
+
f25c7b
 		ap = nm_wifi_ap_new_from_properties (bss_info);
f25c7b
 
f25c7b
 		/* Let the manager try to fill in the SSID from seen-bssids lists */
f25c7b
-- 
f25c7b
2.26.2
f25c7b