[PATCH] Fix scanning state when sched_scan is stopped explicitly

Arik Nemtsov arik
Mon Mar 16 04:39:58 PDT 2015

On Fri, Mar 13, 2015 at 8:16 PM, Dmitry Shmidt <dimitrysh at google.com> wrote:
> Changing scanning function may affect others, while resetting PNO
> state should not. Moreover later EVENT_SCHED_SCAN_STOPPED
> will do nothing if sched_scan_timed_out or pno_sched_pending will not
> be set.
>                if (wpa_s->sched_scan_timed_out) {
>                         wpa_supplicant_req_sched_scan(wpa_s);
>                 } else if (wpa_s->pno_sched_pending) {
>                         wpa_s->pno_sched_pending = 0;
>                         wpas_start_pno(wpa_s);
>                 }

Your change can hurt sched-scan users. For instance if
wpa_s->sched_scan_timed_out is set, then your patch will introduce a
time-window where a regular scan might come in before the
EVENT_SCHED_SCAN_STOPPED has a chance to arrive.

You introduce a similar race for wpa_s->pno_sched_pending (you even
guarantee it there I believe?).

I guess the easiest fix is to have another pno related flag
(wpa_s->restart_scan_after_pno ?) and checking it in
EVENT_SCHED_SCAN_STOPPED for restarting the regular scan.


More information about the Hostap mailing list