From: Jouni Malinen Date: Fri, 13 Apr 2012 13:13:14 +0000 (+0300) Subject: P2P: Fix p2p_connect join scan handler in error cases X-Git-Tag: hostap_2_0~732 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=205e6474a1a1f4d08457814dbdbd6f5c49aaee39;p=thirdparty%2Fhostap.git P2P: Fix p2p_connect join scan handler in error cases wpa_drv_scan() may fail for the initial p2p_connect join scan request, e.g., if the driver happened to be scanning at the time the new operation was initialized. Previously, a special scan result handler was registered regardless of whether the new scan was started. This could result in partial scan results (e.g., from p2p_find social scan) from being used as full results for join (or now more importantly for p2p_connect auto) purposes. Fix this by registering the new scan result handler only if wpa_drv_scan() returns success. Signed-hostap: Jouni Malinen --- diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index 6cef40c13..e4f9d9b85 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -2863,8 +2863,9 @@ static void wpas_p2p_join_scan(void *eloop_ctx, void *timeout_ctx) * Run a scan to update BSS table and start Provision Discovery once * the new scan results become available. */ - wpa_s->scan_res_handler = wpas_p2p_scan_res_join; ret = wpa_drv_scan(wpa_s, ¶ms); + if (!ret) + wpa_s->scan_res_handler = wpas_p2p_scan_res_join; wpabuf_free(ies);