summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-03-01 16:43:35 +0100
committerJeremy Allison <jra@samba.org>2013-03-01 11:59:54 -0800
commitb53c704a34abca0ad69ae9a0dbb0db6a0a71043b (patch)
tree7343c0c79f3264e2826865d8bf573ceedf5b5cd6 /lib
parent6952d761d2b9ebb2457916d9dfa3f070c0f62228 (diff)
downloadsamba-b53c704a34abca0ad69ae9a0dbb0db6a0a71043b.tar.gz
samba-b53c704a34abca0ad69ae9a0dbb0db6a0a71043b.tar.bz2
samba-b53c704a34abca0ad69ae9a0dbb0db6a0a71043b.zip
tevent: revalidate fde->flags after poll()
This is important to avoid races between threads if the poll_mt backend is used. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib')
-rw-r--r--lib/tevent/tevent_poll.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/tevent/tevent_poll.c b/lib/tevent/tevent_poll.c
index 867d951ee1..aa4c50c0c5 100644
--- a/lib/tevent/tevent_poll.c
+++ b/lib/tevent/tevent_poll.c
@@ -594,6 +594,12 @@ static int poll_event_loop_poll(struct tevent_context *ev,
if (pfd->revents & POLLOUT) {
flags |= TEVENT_FD_WRITE;
}
+ /*
+ * Note that fde->flags could be changed when using
+ * the poll_mt backend together with threads,
+ * that why we need to check pfd->revents and fde->flags
+ */
+ flags &= fde->flags;
if (flags != 0) {
fde->handler(ev, fde, flags, fde->private_data);
return 0;