[PATCH 2/2] Ensure reset of wpa_s->scanning if scan is cancelled

Jouni Malinen j
Sun Nov 24 02:14:35 PST 2013

On Tue, Nov 12, 2013 at 12:41:58PM -0800, Dmitry Shmidt wrote:
> diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
> @@ -1217,6 +1217,7 @@ void wpa_supplicant_cancel_scan(struct wpa_supplicant *wpa_s)
>  	wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling scan request");
>  	eloop_cancel_timeout(wpa_supplicant_scan, wpa_s, NULL);
>  	wpas_p2p_continue_after_scan(wpa_s);
> +	wpa_supplicant_notify_scanning(wpa_s, 0);

This does not look correct and can result in unexpected notifications of
scanning being stopped. wpa_supplicant_cancel_scan() cancels a scheduled
scan request, not an ongoing scan. If there is no ongoing scan,
wpa_s->scanning == 0 and this change would not achieve anything. If
there is an ongoing scan, this would claim that the scan has been
completed, even though it has not, and as such, this could result in
incorrect behavior.

Why would this change be needed and is there really justification for
breaking the existing scan notification mechanism because of that?

Jouni Malinen                                            PGP id EFC895FA

More information about the Hostap mailing list