Re: x86, x32: Correct invalid use of user timespec in the kernel
From: H. Peter Anvin
Date: Fri Jan 31 2014 - 13:06:59 EST
On 01/31/2014 09:50 AM, Dave Jones wrote:
> On Fri, Jan 31, 2014 at 02:54:53AM +0000, Linux Kernel wrote:
>
> > Commit: 2def2ef2ae5f3990aabdbe8a755911902707d268
> >
> > ...
> >
> > - if (get_compat_timespec(&ktspec, timeout))
> > + if (compat_get_timespec(&ktspec, timeout))
> > return -EFAULT;
> >
> > datagrams = __sys_recvmmsg(fd, (struct mmsghdr __user *)mmsg, vlen,
> > flags | MSG_CMSG_COMPAT, &ktspec);
> > - if (datagrams > 0 && put_compat_timespec(&ktspec, timeout))
> > + if (datagrams > 0 && compat_put_timespec(&ktspec, timeout))
> > datagrams = -EFAULT;
> >
>
> Can we rename one of each of those functions ?
> It's not really surprising they got mixed up given they look so alike.
>
> It looks like an accident just waiting to happen again.
>
Very much so, I made the same comment.
My feeling is that {get,put}_compat_timespec() should at the very least
have leading underscores to flag it as a low-level function, but better
suggestions would be appreciated.
-hpa
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/