From c9a98d9681e81c51448169b9bb0ceeb11d979a7e Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 16 Mar 2017 15:31:37 -0500 Subject: [PATCH] device: Fix crash with autoconnect ++++++++ backtrace ++++++++ 0 0x7fc0b20ca370 in /lib64/libc.so.6 1 0x4497d5 in l_dbus_message_new_error_valist() at /home/denkenz/iwd/ell/dbus-message.c:372 2 0x44994d in l_dbus_message_new_error() at /home/denkenz/iwd/ell/dbus-message.c:394 3 0x41369b in dbus_error_not_supported() at /home/denkenz/iwd/src/dbus.c:148 4 0x40eaf5 in device_connect_network() at /home/denkenz/iwd/src/device.c:1282 5 0x41f61c in network_autoconnect() at /home/denkenz/iwd/src/network.c:424 6 0x40c1c1 in device_autoconnect_next() at /home/denkenz/iwd/src/device.c:172 7 0x40cabf in device_set_scan_results() at /home/denkenz/iwd/src/device.c:368 8 0x40cb06 in new_scan_results() at /home/denkenz/iwd/src/device.c:376 9 0x41be8a in scan_finished() at /home/denkenz/iwd/src/scan.c:1021 10 0x41bf9e in get_scan_done() at /home/denkenz/iwd/src/scan.c:1048 11 0x43d5ce in destroy_request() at /home/denkenz/iwd/ell/genl.c:136 12 0x43ded1 in process_unicast() at /home/denkenz/iwd/ell/genl.c:395 13 0x43e295 in received_data() at /home/denkenz/iwd/ell/genl.c:502 14 0x43aa62 in io_callback() at /home/denkenz/iwd/ell/io.c:120 15 0x439632 in l_main_run() at /home/denkenz/iwd/ell/main.c:375 (discriminator 2) 16 0x403074 in main() at /home/denkenz/iwd/src/main.c:261 17 0x7fc0b20b7620 in /lib64/libc.so.6 --- src/device.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/device.c b/src/device.c index 4aafaef6..d2cfd933 100644 --- a/src/device.c +++ b/src/device.c @@ -1256,17 +1256,18 @@ void device_connect_network(struct device *device, struct network *network, handshake_state_set_mde(hs, mde); } - device->connect_pending = l_dbus_message_ref(message); - if (netdev_connect(device->netdev, bss, hs, device_netdev_event, device_connect_cb, device) < 0) { handshake_state_free(hs); - dbus_pending_reply(&device->connect_pending, - dbus_error_failed(device->connect_pending)); + if (message) + l_dbus_send(dbus, dbus_error_failed(message)); + return; } + device->connect_pending = l_dbus_message_ref(message); + device->connected_bss = bss; device->connected_network = network; @@ -1279,7 +1280,8 @@ void device_connect_network(struct device *device, struct network *network, return; not_supported: - l_dbus_send(dbus, dbus_error_not_supported(message)); + if (message) + l_dbus_send(dbus, dbus_error_not_supported(message)); } static void device_scan_triggered(int err, void *user_data)