Re: [PATCH] Fix potential bugs of wpa_ctrl_request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2021-07-23 at 06:01 -0400, Alan DeKok wrote:
> On Jul 23, 2021, at 5:41 AM, xinpeng wang <wangxinpeng@xxxxxxxxxxxxx> wrote:
> > 
> > wpa_ctrl_request will block for up to 10 seconds while waiting for the reply,
> > but when this function call select is interrupted, re-assign the timeout parameter to 10s,
> > which will cause the time to exceed 10s;
> > if it is interrupted all the time, this function may block for a very long time
> 
>   This patch helps on Linux, it is likely to not work on other systems.
> 
>   Setting the time outside of the loop is good, but that relies on select() updating the value of &tv when it returns.  IIRC, only Linux does that.  Other operating systems don't touch "tv", which means it's value is left at 10.
> 
>   I've attached my own attempt at a patch.  It calculates the end time, and then updates "tv" on every iteration of the loop.

Looks good to me. Technically, you could also move the "started_at"
variable into the loop together with "diff", you only need "ending_at"
to be outside.

johannes


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap




[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux