From 3586d55a5d2d2af4fabf85ae72ceb5af6897871c Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Tue, 28 Oct 2014 01:47:17 +0200 Subject: [PATCH] P2P: Do not call wpas_p2p_disconnect_safely() if no match is found In theory, wpas_p2p_disconnect_safely() could have dereferenced the wpa_s == NULL argument, but in practice, it won't due to the calling_wpa_s == wpa_s check and wpas_p2p_disconnect() accepting NULL. Anyway, it is cleaner to add an explicit check for this. (CID 74492) Signed-off-by: Jouni Malinen --- wpa_supplicant/p2p_supplicant.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 0e4361444..2712bb3d4 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -455,7 +455,7 @@ static void run_wpas_p2p_disconnect(void *eloop_ctx, void *timeout_ctx) static int wpas_p2p_disconnect_safely(struct wpa_supplicant *wpa_s, struct wpa_supplicant *calling_wpa_s) { - if (calling_wpa_s == wpa_s && + if (calling_wpa_s == wpa_s && wpa_s && wpa_s->p2p_group_interface != NOT_P2P_GROUP_INTERFACE) { /* * The calling wpa_s instance is going to be removed. Do that