Re: [PATCH -mm 4/7][AIO] Resend - Make good_sigevent() non-static

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux