All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] uio: Fix memory size check with vma in uio_mmap_physical()
Date: Mon, 17 Mar 2014 16:26:45 -0700	[thread overview]
Message-ID: <20140317232645.GA11450@kroah.com> (raw)
In-Reply-To: <1394587461-8574-1-git-send-email-nobuhiro.iwamatsu.yj@renesas.com>

On Wed, Mar 12, 2014 at 10:24:21AM +0900, Nobuhiro Iwamatsu wrote:
> Register for the device are mapped in uio_mmap_physical().
> In this case, it might not be the same as the size of VMA always.

Why wouldn't this be the case?

> This uses PAGE_ALIGN to memory size, fix the check of the memory size
> to be mapped.
> 
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
> ---
>  drivers/uio/uio.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/uio/uio.c b/drivers/uio/uio.c
> index a673e5b..e371f5a 100644
> --- a/drivers/uio/uio.c
> +++ b/drivers/uio/uio.c
> @@ -655,7 +655,7 @@ static int uio_mmap_physical(struct vm_area_struct *vma)
>  
>  	if (mem->addr & ~PAGE_MASK)
>  		return -ENODEV;
> -	if (vma->vm_end - vma->vm_start > mem->size)
> +	if (vma->vm_end - vma->vm_start > PAGE_ALIGN(mem->size))

You just increased the size for the check, that seems wrong.  Why
wouldn't mem->size be correct here?

What hardware is failing for this with a valid size and end/start
addresses?

thanks,

greg k-h

  reply	other threads:[~2014-03-17 23:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-12  1:24 [PATCH] uio: Fix memory size check with vma in uio_mmap_physical() Nobuhiro Iwamatsu
2014-03-17 23:26 ` Greg KH [this message]
2014-03-20  8:24   ` Nobuhiro Iwamatsu

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=20140317232645.GA11450@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nobuhiro.iwamatsu.yj@renesas.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.