Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965257AbWKIT1M (ORCPT ); Thu, 9 Nov 2006 14:27:12 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754831AbWKIT1M (ORCPT ); Thu, 9 Nov 2006 14:27:12 -0500 Received: from e32.co.us.ibm.com ([32.97.110.150]:24786 "EHLO e32.co.us.ibm.com") by vger.kernel.org with ESMTP id S1754829AbWKIT1L (ORCPT ); Thu, 9 Nov 2006 14:27:11 -0500 Subject: Re: [PATCH -mm 3/3][AIO] - AIO completion signal notification From: Badari Pulavarty To: Christoph Hellwig Cc: S?bastien Dugu? , "linux-kernel@vger.kernel.org" , Suparna Bhattacharya , Ulrich Drepper , Zach Brown , Dave Jones , Jean Pierre Dion , "linux-aio@kvack.org" In-Reply-To: <20061109190843.GA20321@infradead.org> References: <1163087717.3879.34.camel@frecb000686> <1163087946.3879.43.camel@frecb000686> <20061109190843.GA20321@infradead.org> Content-Type: text/plain Date: Thu, 09 Nov 2006 11:27:08 -0800 Message-Id: <1163100428.10295.3.camel@dyn9047017100.beaverton.ibm.com> Mime-Version: 1.0 X-Mailer: Evolution 2.0.4 (2.0.4-4) Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2186 Lines: 75 On Thu, 2006-11-09 at 19:08 +0000, Christoph Hellwig wrote: Looks much better :) > > static long aio_setup_sigevent(struct kiocb *iocb, > struct sigevent __user *user_event) > { > sigevent_t event; > struct task_struct *target; > unsigned long flags; > > if (copy_from_user(&event, user_event, sizeof (event))) > return -EFAULT; > > if (event.sigev_notify == SIGEV_NONE) > return 0; > > iocb->ki_notify.notify = event.sigev_notify; Don't we want to verify to make sure that we are accepting only SIGEV_SIGNAL or SIGEV_THREAD_ID and return -EINVAL, if some one passes invalid event ? Like if ((event.sigev_notify != SIGEV_SIGNAL) && (event.sigev_notify != SIGEV_THREAD_ID)) return -EINVAL; > iocb->ki_notify.signo = event.sigev_signo; > iocb->ki_notify.value = event.sigev_value; > > read_lock(&tasklist_lock); > target = good_sigevent(&event); > if (unlikely(!target || (target->flags & PF_EXITING))) > goto out_unlock; > iocb->ki_notify.target = target; > > if (iocb->ki_notify.notify == (SIGEV_SIGNAL|SIGEV_THREAD_ID)) { > /* > * This reference will be dropped when we're done with > * the request. > */ > get_task_struct(target); > } > read_unlock(&tasklist_lock); > > /* > * NOTE: we cannot free the sigqueue in the completion path as > * the signal may not have been delivered to the target task. > * Therefore it has to be freed in __sigqueue_free() when the > * signal is collected if si_code is SI_ASYNCIO. > */ > iocb->ki_sigq = sigqueue_alloc(); > if (unlikely(!iocb->ki_sigq)) { > put_task_struct(target); > return -EAGAIN; > } > > return 0; > out_unlock: > read_unlock(&tasklist_lock); > return -EINVAL; > } > > -- > To unsubscribe, send a message with 'unsubscribe linux-aio' in > the body to majordomo@kvack.org. For more info on Linux AIO, > see: http://www.kvack.org/aio/ > Don't email: aart@kvack.org - 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/