3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

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)
This commit is contained in:
Tim Kourt 2020-06-09 18:23:56 -07:00 committed by Denis Kenzior
parent 8be7aae079
commit ecd39dcf0d
3 changed files with 8 additions and 8 deletions

View File

@ -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)

View File

@ -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);

View File

@ -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;