[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20070205134314.GA283@tv-sign.ru>
Date: Mon, 5 Feb 2007 16:43:14 +0300
From: Oleg Nesterov <oleg@...sign.ru>
To: S?bastien Dugu? <sebastien.dugue@...l.net>
Cc: linux-kernel <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...l.org>, linux-aio <linux-aio@...ck.org>,
Bharata B Rao <bharata@...ibm.com>,
Christoph Hellwig <hch@...radead.org>,
Suparna Bhattacharya <suparna@...ibm.com>,
Ulrich Drepper <drepper@...hat.com>,
Zach Brown <zach.brown@...cle.com>,
Badari Pulavarty <pbadari@...ibm.com>,
Benjamin LaHaise <bcrl@...ux.intel.com>,
Jean Pierre Dion <jean-pierre.dion@...l.net>
Subject: Re: [PATCH -mm 4/7][AIO] Resend - Make good_sigevent() non-static
On 02/05, S?bastien Dugu? wrote:
>
> +struct task_struct * sigevent_find_task(sigevent_t * event)
> +{
> + struct task_struct *task = current->group_leader;
> +
> + if ((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_NONE) {
> + if (event->sigev_signo <= 0 || event->sigev_signo > SIGRTMAX)
> + return NULL;
> + }
> +
> + if (event->sigev_notify & SIGEV_THREAD_ID) {
> + if ((event->sigev_notify & ~SIGEV_THREAD_ID) != SIGEV_SIGNAL)
> + return NULL;
> +
> + task = find_task_by_pid(event->sigev_notify_thread_id);
> +
> + if (!task || task->tgid != current->tgid)
> + task = NULL;
> + }
> +
> + return task;
> +}
I think this patch is correct, and the code is much more readable than
the old good_sigevet().
But please don't forget that PATCH 6/7 still needs a small fixup, we can
leak a task_struct in really_put_req()
if (notify == SIGEV_THREAD_ID || notify == SIGEV_SIGNAL)
put_task_struct(req->ki_notify.target);
because without SIGEV_THREAD_ID ->sigev_notify can have any bit/bits set,
even SIGEV_NONE (along with some other bit, aio_setup_sigevent checks for
== SIGEV_NONE).
Oleg.
-
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