iwd: fix assertion failure when requesting scan

if device *is* a NM_DEVICE_IWD, then make sure to not pass that to
_nm_device_wifi_request_scan (which asserts on anything else than a
NM_DEVICE_WIFI device).

The crash can be triggered by enabling wifi.backend=iwd and clicking
on the 'select network' item in gnome shell for example. The journal
output looks like this:

NetworkManager[1861]: invalid cast from 'NMDeviceIwd' to 'NMDeviceWifi'
NetworkManager[1861]: **
NetworkManager[1861]: NetworkManager:ERROR:src/devices/wifi/nm-device-wifi.c:1127:_nm_device_wifi_request_scan: assertion failed: ((((__extension__ ({ GTypeInstance *__inst = (GTypeInstance*) ((_obj)); GType __t = ((nm_device_wifi_get_type ())); gboolean __r; if (!__inst) __r = (0); else if (__inst->g_class && __inst->g_class->g_type == __t) __r = (!(0)); else __r = g_type_check_instance_is_a (__inst, __t); __r; })))))
systemd[1]: NetworkManager.service: Main process exited, code=dumped, status=6/ABRT
systemd[1]: NetworkManager.service: Failed with result 'core-dump'.

Fixes: 297d4985ab

https://github.com/NetworkManager/NetworkManager/pull/107
This commit is contained in:
Andreas Henriksson 2018-04-24 19:25:40 +02:00 committed by Thomas Haller
parent 9731b06b78
commit be28790183

View file

@ -69,6 +69,7 @@ _dispatch_request_scan (NMDevice *device,
_nm_device_iwd_request_scan (NM_DEVICE_IWD (device),
options,
invocation);
return;
}
#endif
_nm_device_wifi_request_scan (NM_DEVICE_WIFI (device),