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 [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to