mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 3/6] [-mm] epoll: remember the event if epoll_wait returns -EFAULT
@ 2009-02-24 17:28 Tony Battersby
  2009-02-26 16:36 ` Davide Libenzi
  0 siblings, 1 reply; 2+ messages in thread
From: Tony Battersby @ 2009-02-24 17:28 UTC (permalink / raw)
  To: Andrew Morton, Davide Libenzi; +Cc: Jonathan Corbet, linux-kernel

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>
---

This patch is against the current -mm tree, and might not apply
to 2.6.29.  Since this patch probably won't go into 2.6.29, you may
apply this version of the patch after the other patches in -mm.

--- a/fs/eventpoll.c	2009-02-23 14:01:41.000000000 -0500
+++ b/fs/eventpoll.c	2009-02-23 14:01:47.000000000 -0500
@@ -1119,8 +1119,10 @@ static int ep_send_events_proc(struct ev
 		 */
 		if (revents) {
 			if (__put_user(revents, &uevent->events) ||
-			    __put_user(epi->event.data, &uevent->data))
+			    __put_user(epi->event.data, &uevent->data)) {
+				list_add(&epi->rdllink, head);
 				return eventcnt ? eventcnt : -EFAULT;
+			}
 			eventcnt++;
 			uevent++;
 			if (epi->event.events & EPOLLONESHOT)


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 3/6] [-mm] epoll: remember the event if epoll_wait returns -EFAULT
  2009-02-24 17:28 [PATCH 3/6] [-mm] epoll: remember the event if epoll_wait returns -EFAULT Tony Battersby
@ 2009-02-26 16:36 ` Davide Libenzi
  0 siblings, 0 replies; 2+ messages in thread
From: Davide Libenzi @ 2009-02-26 16:36 UTC (permalink / raw)
  To: Tony Battersby; +Cc: Andrew Morton, Jonathan Corbet, Linux Kernel Mailing List

On Tue, 24 Feb 2009, Tony Battersby wrote:

> 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.

It doesn't really matter with an EFAULT coming, anyway ...

Acked-by: Davide Libenzi <davidel@xmailserver.org>


- Davide



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-26 16:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-24 17:28 [PATCH 3/6] [-mm] epoll: remember the event if epoll_wait returns -EFAULT Tony Battersby
2009-02-26 16:36 ` Davide Libenzi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome