Skip to content

Commit 49341e9

Browse files
Julio Pintossmalyshev
Julio Pintos
authored andcommitted
Fix #66908: php-fpm reload leaks epoll_create() file descriptor
This patch fixes descriptor leak which could lead to DoS once Max open files is reached
1 parent a18cec1 commit 49341e9

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ PHP NEWS
1111
. Fixed bug #67081 (DOMDocumentType->internalSubset returns entire DOCTYPE tag,
1212
not only the subset). (Anatol)
1313

14+
- FPM:
15+
. Fixed bug #66908 (php-fpm reload leaks epoll_create() file descriptor).
16+
(Julio Pintos)
17+
1418
?? ??? 2014, PHP 5.4.28
1519

1620
- Core:

sapi/fpm/fpm/events/epoll.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static struct fpm_event_module_s epoll_module = {
4646

4747
static struct epoll_event *epollfds = NULL;
4848
static int nepollfds = 0;
49-
static int epollfd = 0;
49+
static int epollfd = -1;
5050

5151
#endif /* HAVE_EPOLL */
5252

@@ -103,6 +103,10 @@ static int fpm_event_epoll_clean() /* {{{ */
103103
free(epollfds);
104104
epollfds = NULL;
105105
}
106+
if (epollfd != -1) {
107+
close(epollfd);
108+
epollfd = -1;
109+
}
106110

107111
nepollfds = 0;
108112

0 commit comments

Comments
 (0)