All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: linux-media@vger.kernel.org, mchehab@redhat.com,
	pawel@osciak.com, kyungmin.park@samsung.com
Subject: Re: [PATCH] media: vb2: add length check for mmap
Date: Fri, 12 Apr 2013 08:03:15 +0200	[thread overview]
Message-ID: <5167A3A3.5090200@samsung.com> (raw)
In-Reply-To: <1365739077-8740-1-git-send-email-sw0312.kim@samsung.com>


On 4/12/2013 5:57 AM, Seung-Woo Kim wrote:
> The length of mmap() can be bigger than length of vb2 buffer, so
> it should be checked.
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>

Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/media/v4l2-core/videobuf2-core.c |    5 +++++
>   1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
> index db1235d..2c6ff2d 100644
> --- a/drivers/media/v4l2-core/videobuf2-core.c
> +++ b/drivers/media/v4l2-core/videobuf2-core.c
> @@ -1886,6 +1886,11 @@ int vb2_mmap(struct vb2_queue *q, struct vm_area_struct *vma)
>   
>   	vb = q->bufs[buffer];
>   
> +	if (vb->v4l2_planes[plane].length < (vma->vm_end - vma->vm_start)) {
> +		dprintk(1, "Invalid length\n");
> +		return -EINVAL;
> +	}
> +
>   	ret = call_memop(q, mmap, vb->planes[plane].mem_priv, vma);
>   	if (ret)
>   		return ret;

Best regards
-- 
Marek Szyprowski
Samsung Poland R&D Center



  reply	other threads:[~2013-04-12  6:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-12  3:57 [PATCH] media: vb2: add length check for mmap Seung-Woo Kim
2013-04-12  6:03 ` Marek Szyprowski [this message]
2013-04-16 10:21   ` Laurent Pinchart
2013-04-18  2:53   ` 김승우

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=5167A3A3.5090200@samsung.com \
    --to=m.szyprowski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@redhat.com \
    --cc=pawel@osciak.com \
    --cc=sw0312.kim@samsung.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.