]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
P2P: Do not filter pref_freq_list if the driver does not provide one
authorJouni Malinen <quic_jouni@quicinc.com>
Fri, 18 Aug 2023 17:40:12 +0000 (20:40 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 18 Aug 2023 17:40:12 +0000 (20:40 +0300)
wpa_drv_get_pref_freq_list() may fail and the 6 GHz channel removal
should not be done unless the operation actually succeeded. The previous
implementation ended up processing uninitialized data. This did not
really result in any observable misbehavior since the result was not
used, but this showed up as a failed test case when running tests with
valgrind.

Fixes: f0cdacacb356 ("P2P: Allow connection on 6 GHz channels if requested")
Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
wpa_supplicant/p2p_supplicant.c

index 9c6e24d6ffa2a6f85e4fa188d5fbc0ff08698d74..e60beda72ba027e267a49364ed7f718b9e9ed262 100644 (file)
@@ -6263,7 +6263,7 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
 
                res = wpa_drv_get_pref_freq_list(wpa_s, WPA_IF_P2P_GO,
                                                 &size, pref_freq_list);
-               if (!is_p2p_allow_6ghz(wpa_s->global->p2p))
+               if (!res && size > 0 && !is_p2p_allow_6ghz(wpa_s->global->p2p))
                        size = p2p_remove_6ghz_channels(pref_freq_list, size);
 
                if (!res && size > 0) {