[PATCH] Fix potential bugs of wpa_ctrl_request

Alan DeKok aland at deployingradius.com
Fri Jul 23 03:01:59 PDT 2021

On Jul 23, 2021, at 5:41 AM, xinpeng wang <wangxinpeng at uniontech.com> 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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Wait-for-a-total-of-10-seconds-not-10-seconds-per-it.patch
Type: application/octet-stream
Size: 1385 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/hostap/attachments/20210723/09a71367/attachment.obj>

More information about the Hostap mailing list