diff options
author | Tony Battersby <tonyb@cybernetics.com> | 2009-03-31 18:24:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-01 11:59:19 -0400 |
commit | d0305882825784e74f68a56eee6c3a812a99f235 (patch) | |
tree | a4dcfea753279e1f8f4e7cc8256a8f5c195341ce /fs | |
parent | abff55cee1039b5a3b96f7a5eb6e65b9f247a274 (diff) |
epoll: remember the event if epoll_wait returns -EFAULT
If epoll_wait returns -EFAULT, the event that was being returned when the
fault was encountered will be forgotten. This is not a big deal since
EFAULT will happen only if a buggy userspace program passes in a bad
address, in which case what happens later usually doesn't matter.
However, it is easy to remember the event for later, and this patch makes
a simple change to do that.
Signed-off-by: Tony Battersby <tonyb@cybernetics.com>
Acked-by: Davide Libenzi <davidel@xmailserver.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/eventpoll.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index db4365f8a75c..c806a0c4383c 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -1054,8 +1054,10 @@ static int ep_send_events_proc(struct eventpoll *ep, struct list_head *head, | |||
1054 | */ | 1054 | */ |
1055 | if (revents) { | 1055 | if (revents) { |
1056 | if (__put_user(revents, &uevent->events) || | 1056 | if (__put_user(revents, &uevent->events) || |
1057 | __put_user(epi->event.data, &uevent->data)) | 1057 | __put_user(epi->event.data, &uevent->data)) { |
1058 | list_add(&epi->rdllink, head); | ||
1058 | return eventcnt ? eventcnt : -EFAULT; | 1059 | return eventcnt ? eventcnt : -EFAULT; |
1060 | } | ||
1059 | eventcnt++; | 1061 | eventcnt++; |
1060 | uevent++; | 1062 | uevent++; |
1061 | if (epi->event.events & EPOLLONESHOT) | 1063 | if (epi->event.events & EPOLLONESHOT) |