diff options
author | Tim Kourt <tim.a.kourt@linux.intel.com> | 2020-06-09 18:23:56 -0700 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2020-06-09 21:59:36 -0500 |
commit | ecd39dcf0dde8bf2bec7952e22c08cac4eba2c7f (patch) | |
tree | cc41a78081ce8a5408d35641a464a88ed100e834 | |
parent | 8be7aae079471d958d14795ffa309734c24abaaf (diff) | |
download | iwd-ecd39dcf0dde8bf2bec7952e22c08cac4eba2c7f.tar.gz |
network: Don't crash when network_connect_new_hidden_network fails
Change signature of network_connect_new_hidden_network to take
reference to the caller's l_dbus_message struct. This allows to
set the caller's l_dbus_message struct to NULL after replying in
the case of a failure.
==201== at 0x467C15: l_dbus_message_unref (dbus-message.c:412)
==201== by 0x412A51: station_hidden_network_scan_results (station.c:2504)
==201== by 0x41EAEA: scan_finished (scan.c:1505)
==201== by 0x41EC10: get_scan_done (scan.c:1535)
==201== by 0x462592: destroy_request (genl.c:673)
==201== by 0x462987: process_unicast (genl.c:988)
==201== by 0x462987: received_data (genl.c:1087)
==201== by 0x45F5A2: io_callback (io.c:126)
==201== by 0x45E8FD: l_main_iterate (main.c:474)
==201== by 0x45E9BB: l_main_run (main.c:521)
==201== by 0x45EBCA: l_main_run_with_signal (main.c:643)
==201== by 0x403B15: main (main.c:512)
-rw-r--r-- | src/network.c | 12 | ||||
-rw-r--r-- | src/network.h | 2 | ||||
-rw-r--r-- | src/station.c | 2 |
3 files changed, 8 insertions, 8 deletions
diff --git a/src/network.c b/src/network.c index c08d7e725..170db3e5f 100644 --- a/src/network.c +++ b/src/network.c @@ -1166,7 +1166,7 @@ static struct l_dbus_message *network_connect(struct l_dbus *dbus, } void network_connect_new_hidden_network(struct network *network, - struct l_dbus_message *message) + struct l_dbus_message **message) { struct station *station = network->station; struct scan_bss *bss; @@ -1183,7 +1183,7 @@ void network_connect_new_hidden_network(struct network *network, bss = network_bss_select(network, true); if (!bss) { /* This should never happened for the hidden networks. */ - error = dbus_error_not_supported(message); + error = dbus_error_not_supported(*message); goto reply_error; } @@ -1192,13 +1192,13 @@ void network_connect_new_hidden_network(struct network *network, switch (network_get_security(network)) { case SECURITY_PSK: - error = network_connect_psk(network, bss, message); + error = network_connect_psk(network, bss, *message); break; case SECURITY_NONE: - station_connect_network(station, network, bss, message); + station_connect_network(station, network, bss, *message); return; default: - error = dbus_error_not_supported(message); + error = dbus_error_not_supported(*message); break; } @@ -1208,7 +1208,7 @@ void network_connect_new_hidden_network(struct network *network, return; reply_error: - dbus_pending_reply(&message, error); + dbus_pending_reply(message, error); } void network_blacklist_add(struct network *network, struct scan_bss *bss) diff --git a/src/network.h b/src/network.h index 8e0ed6367..fbb120a70 100644 --- a/src/network.h +++ b/src/network.h @@ -70,7 +70,7 @@ int network_rank_compare(const void *a, const void *b, void *user); void network_rank_update(struct network *network, bool connected); void network_connect_new_hidden_network(struct network *network, - struct l_dbus_message *message); + struct l_dbus_message **message); void network_blacklist_add(struct network *network, struct scan_bss *bss); diff --git a/src/station.c b/src/station.c index 583016ab7..87fadc3fc 100644 --- a/src/station.c +++ b/src/station.c @@ -2500,7 +2500,7 @@ next: network = network_psk ? : network_open; - network_connect_new_hidden_network(network, msg); + network_connect_new_hidden_network(network, &msg); l_dbus_message_unref(msg); return true; |