public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@linux.intel.com>
To: Dave Jones <davej@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: x86, x32: Correct invalid use of user timespec in the kernel
Date: Fri, 31 Jan 2014 10:06:38 -0800	[thread overview]
Message-ID: <52EBE62E.70102@linux.intel.com> (raw)
In-Reply-To: <20140131175009.GA27231@redhat.com>

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



  reply	other threads:[~2014-01-31 18:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20140131025453.B594B660CA3@gitolite.kernel.org>
2014-01-31 17:50 ` x86, x32: Correct invalid use of user timespec in the kernel Dave Jones
2014-01-31 18:06   ` H. Peter Anvin [this message]
2014-01-31 18:45     ` Linus Torvalds
2014-01-31 19:00       ` H. Peter Anvin
2014-01-31 19:13       ` H. Peter Anvin
2014-01-31 22:37       ` H. Peter Anvin
2014-02-01 19:07         ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52EBE62E.70102@linux.intel.com \
    --to=hpa@linux.intel.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox