[PATCH] epoll: allow 0 for "unlimited" on epoll limits

From: Bron Gondwana
Date: Sun Jan 25 2009 - 07:17:31 EST


---
fs/eventpoll.c | 10 ++++++----
1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 2113795..ce8879b 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -597,8 +597,9 @@ static int ep_alloc(struct eventpoll **pep)

user = get_current_user();
error = -EMFILE;
- if (unlikely(atomic_read(&user->epoll_devs) >=
- epoll_limits.max_user_instances))
+ if (unlikely(epoll_limits.max_user_instances &&
+ (atomic_read(&user->epoll_devs) >=
+ epoll_limits.max_user_instances)))
goto free_uid;
error = -ENOMEM;
ep = kzalloc(sizeof(*ep), GFP_KERNEL);
@@ -776,8 +777,9 @@ static int ep_insert(struct eventpoll *ep, struct epoll_event *event,
struct epitem *epi;
struct ep_pqueue epq;

- if (unlikely(atomic_read(&ep->user->epoll_watches) >=
- epoll_limits.max_user_watches))
+ if (unlikely(epoll_limits.max_user_watches &&
+ (atomic_read(&ep->user->epoll_watches) >=
+ epoll_limits.max_user_watches)))
return -ENOSPC;
if (!(epi = kmem_cache_alloc(epi_cache, GFP_KERNEL)))
return -ENOMEM;
--
1.5.6.3


--UugvWAfsgieZRqgk--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/