Re: [RESEND PATCH 1/3] epoll: Extract epoll_wait_do and epoll_pwait_do

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

 



On Thu, Jan 8, 2015 at 1:16 AM, Fam Zheng <famz@xxxxxxxxxx> wrote:
> +       if (!timeout || (timeout->tv_nsec == 0 && timeout->tv_sec == 0)) {
..
> +       } else if (timeout->tv_nsec >= 0 && timeout->tv_sec >= 0) {

the check for tv_nsec is not enough, which points
to the fragility of passing user timespec around.
I think it would be safer and cleaner to do it futex style:
  if (copy_from_user(&ts, utime, sizeof(ts)) != 0)
      return -EFAULT;
  if (!timespec_valid(&ts))
      return -EINVAL;
  t = timespec_to_ktime(ts);
and then only pass ktime_t around.

> +               struct timespec end_time = ep_set_mstimeout(timeout);

the name is now wrong, since it's no longer MStimeout.

I think handling of compat is missing as well.
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux