P2P: Fix possible NULL pointer dereference

Fix wpas_p2p_invite() to call p2p_set_own_pref_freq_list() after the
NULL check, to avoid NULL pointer dereference if P2P initialization were
to have failed or P2P module getting deinitialized.

Signed-off-by: Ayala Beker <ayala.beker@intel.com>
This commit is contained in:
Ayala Beker 2015-12-10 12:56:02 +02:00 committed by Jouni Malinen
parent 05736da8c6
commit 1b3dd69d93

View file

@ -6770,11 +6770,12 @@ int wpas_p2p_invite(struct wpa_supplicant *wpa_s, const u8 *peer_addr,
pref_freq_list, &size); pref_freq_list, &size);
if (res) if (res)
return res; return res;
p2p_set_own_pref_freq_list(wpa_s->global->p2p, pref_freq_list, size);
if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL)
return -1; return -1;
p2p_set_own_pref_freq_list(wpa_s->global->p2p, pref_freq_list, size);
if (wpa_s->parent->conf->p2p_ignore_shared_freq && if (wpa_s->parent->conf->p2p_ignore_shared_freq &&
no_pref_freq_given && pref_freq > 0 && no_pref_freq_given && pref_freq > 0 &&
wpa_s->num_multichan_concurrent > 1 && wpa_s->num_multichan_concurrent > 1 &&