Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932478AbXBENlZ (ORCPT ); Mon, 5 Feb 2007 08:41:25 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S932417AbXBENlY (ORCPT ); Mon, 5 Feb 2007 08:41:24 -0500 Received: from mail.screens.ru ([213.234.233.54]:53477 "EHLO mail.screens.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932478AbXBENlY (ORCPT ); Mon, 5 Feb 2007 08:41:24 -0500 Date: Mon, 5 Feb 2007 16:43:14 +0300 From: Oleg Nesterov To: S?bastien Dugu? Cc: linux-kernel , Andrew Morton , linux-aio , Bharata B Rao , Christoph Hellwig , Suparna Bhattacharya , Ulrich Drepper , Zach Brown , Badari Pulavarty , Benjamin LaHaise , Jean Pierre Dion Subject: Re: [PATCH -mm 4/7][AIO] Resend - Make good_sigevent() non-static Message-ID: <20070205134314.GA283@tv-sign.ru> References: <20070201102252.240130c6@frecb000686> <20070201103053.64489048@frecb000686> <20070202180039.GA658@tv-sign.ru> <20070205131839.6f601c3e@frecb000686> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070205131839.6f601c3e@frecb000686> User-Agent: Mutt/1.5.11 Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1355 Lines: 44 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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/