lkml.org 
[lkml]   [2007]   [Feb]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-02-05 14:43    [W:0.049 / U:0.556 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site