From 7ef84c1b963fc97e400a5bd4feedc8f78b074c04 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Tue, 29 Nov 2011 17:27:13 +0000 Subject: [PATCH] Fixed AIO on Linux, broken in r4306. Events from eventfd do not have c->write set, and the stale event check added in r4306 causes null pointer dereference. --- src/event/modules/ngx_epoll_module.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/event/modules/ngx_epoll_module.c b/src/event/modules/ngx_epoll_module.c index 4f9c5118e..f4003af70 100644 --- a/src/event/modules/ngx_epoll_module.c +++ b/src/event/modules/ngx_epoll_module.c @@ -681,20 +681,20 @@ ngx_epoll_process_events(ngx_cycle_t *cycle, ngx_msec_t timer, ngx_uint_t flags) wev = c->write; - if (c->fd == -1 || wev->instance != instance) { - - /* - * the stale event from a file descriptor - * that was just closed in this iteration - */ - - ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, - "epoll: stale event %p", c); - continue; - } - if ((revents & EPOLLOUT) && wev->active) { + if (c->fd == -1 || wev->instance != instance) { + + /* + * the stale event from a file descriptor + * that was just closed in this iteration + */ + + ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0, + "epoll: stale event %p", c); + continue; + } + if (flags & NGX_POST_THREAD_EVENTS) { wev->posted_ready = 1;