mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-26 04:16:39 +00:00
[PATCH] epoll: return proper error on overflow condition
Noted by Georgi Guninski.
This commit is contained in:
parent
d723a9bc72
commit
3f9459a091
1 changed files with 2 additions and 1 deletions
|
@ -619,6 +619,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event)
|
|||
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 */
|
||||
|
|
Loading…
Reference in a new issue