]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Clean wpa_s->last_ssid when removing a temporary group network
authorXin Deng <quic_deng@quicinc.com>
Tue, 11 Jul 2023 06:18:38 +0000 (23:18 -0700)
committerJouni Malinen <j@w1.fi>
Fri, 18 Aug 2023 17:29:18 +0000 (20:29 +0300)
wpa_supplicant could crash due to dereferencing freed memory in a corner
case. When a reestablished P2P GO group gets removed because the
hardware mode is not supported when switching from 2.4 to 5 GHz. Group
removal in wpas_p2p_group_delete() forget to clean wpa_s->last_ssid due
to the missing wpas_notify_network_removed() call before removing the
network with wpa_config_remove_network().

That could cause a crash when flushing old BSSs which age out in
wpa_bss_flush_by_age() which uses wpa_s->last_ssid in some cases.

Fix this by invoking wpas_notify_network_removed() to clean
wpa_s->last_ssid when removing a temporary P2P group network.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/p2p_supplicant.c

index aa4ce0964cec4350ad5057462a250b038ea8adc2..9c6e24d6ffa2a6f85e4fa188d5fbc0ff08698d74 100644 (file)
@@ -1085,6 +1085,7 @@ static int wpas_p2p_group_delete(struct wpa_supplicant *wpa_s,
                 * Likewise, we don't send out network removed signals for such
                 * network objects.
                 */
+               wpas_notify_network_removed(wpa_s, ssid);
                wpa_config_remove_network(wpa_s->conf, id);
                wpa_supplicant_clear_status(wpa_s);
                wpa_supplicant_cancel_sched_scan(wpa_s);