[PATCH] P2P: add missing NULL check in p2p_ctrl_flush()
Dan Callaghan
dan.callaghan at morsemicro.com
Sun Nov 9 19:08:02 PST 2025
When wpa_supplicant is compiled with CONFIG_TESTING_OPTIONS and receives
a FLUSH command from wpa_cli, p2p_ctrl_flush() may crash due to passing
a NULL pointer into p2p_set_invitation_op_freq().
Add a NULL pointer check, similar to the other NULL pointer check
already in p2p_ctrl_flush().
Fixes: 475f50d71001 ("P2P2: Allow op class and channel override for Invitation Response")
Signed-off-by: Dan Callaghan <dan.callaghan at morsemicro.com>
---
wpa_supplicant/ctrl_iface.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/wpa_supplicant/ctrl_iface.c b/wpa_supplicant/ctrl_iface.c
index 050ed1624..ea7c8785b 100644
--- a/wpa_supplicant/ctrl_iface.c
+++ b/wpa_supplicant/ctrl_iface.c
@@ -7907,7 +7907,8 @@ static void p2p_ctrl_flush(struct wpa_supplicant *wpa_s)
#ifdef CONFIG_TESTING_OPTIONS
os_free(wpa_s->get_pref_freq_list_override);
wpa_s->get_pref_freq_list_override = NULL;
- p2p_set_invitation_op_freq(wpa_s->global->p2p, -1);
+ if (wpa_s->global->p2p)
+ p2p_set_invitation_op_freq(wpa_s->global->p2p, -1);
#endif /* CONFIG_TESTING_OPTIONS */
wpas_p2p_stop_find(wpa_s);
--
2.50.1
More information about the Hostap
mailing list