Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-03-08 08:01:53 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2005-03-08 08:01:53 -0800
commit018c4f0f5fa947caecb8e31360ae20d1ee60561e (patch)
tree79275bf23bbb264bb931a7180d7834e2c645bdff
parentf8e7c4bd98db31729e5e3c920c18ca38100c32b1 (diff)
epoll: return proper error on overflow condition
Noted by Georgi Guninski.
-rw-r--r--fs/eventpoll.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index b11ab1a9ceee..28ecd4ddf522 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -619,6 +619,7 @@ eexit_1:
return error;
}
+#define MAX_EVENTS (INT_MAX / sizeof(struct epoll_event))
/*
* Implement the event wait interface for the eventpoll file. It is the kernel
@@ -635,7 +636,7 @@ asmlinkage long sys_epoll_wait(int epfd, struct epoll_event __user *events,
current, epfd, events, maxevents, timeout));
/* The maximum number of event must be greater than zero */
- if (maxevents <= 0)
+ if (maxevents <= 0 || maxevents > MAX_EVENTS)
return -EINVAL;
/* Verify that the area passed by the user is writeable */