Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932420AbWHCOkp (ORCPT ); Thu, 3 Aug 2006 10:40:45 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932527AbWHCOko (ORCPT ); Thu, 3 Aug 2006 10:40:44 -0400 Received: from pfx2.jmh.fr ([194.153.89.55]:14234 "EHLO pfx2.jmh.fr") by vger.kernel.org with ESMTP id S932420AbWHCOkn (ORCPT ); Thu, 3 Aug 2006 10:40:43 -0400 From: Eric Dumazet To: Evgeniy Polyakov Subject: Re: [take3 1/4] kevent: Core files. Date: Thu, 3 Aug 2006 16:40:34 +0200 User-Agent: KMail/1.9.1 Cc: lkml , David Miller , Ulrich Drepper , netdev , Zach Brown References: <11545983603399@2ka.mipt.ru> In-Reply-To: <11545983603399@2ka.mipt.ru> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200608031640.34513.dada1@cosmosbay.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1080 Lines: 35 On Thursday 03 August 2006 11:46, Evgeniy Polyakov wrote: > Core files. > > This patch includes core kevent files: > - userspace controlling > - kernelspace interfaces > - initialization > - notification state machines > > +static int kevent_user_wait(struct file *file, struct kevent_user *u, > + unsigned int min_nr, unsigned int max_nr, unsigned int timeout, > + void __user *buf) > +{ > > + mutex_lock(&u->ctl_mutex); > + while (num < max_nr && ((k = kqueue_dequeue_ready(u)) != NULL)) { > + if (copy_to_user(buf + num*sizeof(struct ukevent), > + &k->event, sizeof(struct ukevent))) { > + cerr = -EINVAL; > + break; > + } It seems quite wrong to hold ctl_mutex while doing a copy_to_user() (of possibly a large amount of data) : A thread can sleep on a page fault and other threads cannot make progress. Eric - 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/