]> git.ipfire.org Git - thirdparty/hostap.git/commit
eloop: Fix cases where a socket is reopened from a timeout/signal handler
authorJouni Malinen <jouni@qca.qualcomm.com>
Thu, 23 Jul 2015 15:39:35 +0000 (18:39 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 23 Jul 2015 15:39:35 +0000 (18:39 +0300)
commit7c524a64c1cf67729ee6308adccb4a1449389560
treedb1a9b37d1d8073b5212ce4a3a4f3905a8b6108c
parent569f8f9b870bf3b458a65d9030cb62fbcb3cc7e2
eloop: Fix cases where a socket is reopened from a timeout/signal handler

It was possible for a registered eloop socket handler to be unregistered
and re-registered for a re-opened socket with the same fd from a timeout
or signal handler. If such a case happened with the old socket having a
pending event waiting for processing, some eloop combinations could end
up calling the new handler function with the new socket and get stuck
waiting for an event that has not yet happened on the new socket. This
happened with timeout and signal handlers with all eloop.c types. In
addition to that, the epoll case could also trigger this when a socket
handler re-registered a re-opened socket.

Fix these by checking whether there has been socket handler changes
during processing and break the processing round by going back to
select/poll/epoll for an updated result if any changes are done during
the eloop handler calls before processing the old socket results.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
src/utils/eloop.c