[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1163150437.3879.59.camel@frecb000686>
Date: Fri, 10 Nov 2006 10:20:37 +0100
From: Sébastien Dugué <sebastien.dugue@...l.net>
To: Badari Pulavarty <pbadari@...il.com>
Cc: Christoph Hellwig <hch@...radead.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
Suparna Bhattacharya <suparna@...ibm.com>,
Ulrich Drepper <drepper@...hat.com>,
Zach Brown <zach.brown@...cle.com>,
Dave Jones <davej@...hat.com>,
Jean Pierre Dion <jean-pierre.dion@...l.net>,
"linux-aio@...ck.org" <linux-aio@...ck.org>
Subject: Re: [PATCH -mm 3/3][AIO] - AIO completion signal notification
On Thu, 2006-11-09 at 11:27 -0800, Badari Pulavarty wrote:
> On Thu, 2006-11-09 at 19:08 +0000, Christoph Hellwig wrote:
>
> Looks much better :)
Indeed ;-)
>
> >
> > 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;
That check is done in good_sigevent() below.
>
> > 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;
> > }
Thanks,
Sébastien.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists