Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758092AbZCBXKy (ORCPT ); Mon, 2 Mar 2009 18:10:54 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756791AbZCBXKR (ORCPT ); Mon, 2 Mar 2009 18:10:17 -0500 Received: from host64.cybernetics.com ([98.174.209.230]:3743 "EHLO mail.cybernetics.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756697AbZCBXKQ (ORCPT ); Mon, 2 Mar 2009 18:10:16 -0500 Message-ID: <49AC6755.6050809@cybernetics.com> Date: Mon, 02 Mar 2009 18:10:13 -0500 From: Tony Battersby User-Agent: Thunderbird 2.0.0.19 (X11/20090105) MIME-Version: 1.0 To: Andrew Morton Cc: Davide Libenzi , Linux Kernel Mailing List Subject: [PATCH 2/5] epoll: remember the event if epoll_wait returns -EFAULT Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1253 Lines: 31 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 Acked-by: Davide Libenzi --- --- a/fs/eventpoll.c 2009-02-23 14:01:41.000000000 -0500 +++ b/fs/eventpoll.c 2009-02-23 14:01:47.000000000 -0500 @@ -1082,8 +1082,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) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/