From: Daniel Vetter <daniel@ffwll.ch>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: David Airlie <airlied@linux.ie>,
Daniel Vetter <daniel.vetter@ffwll.ch>,
dri-devel@lists.freedesktop.org,
Brian Norris <briannorris@chromium.org>,
kernel-janitors@vger.kernel.org,
Matthew Wilcox <willy@infradead.org>,
Cihangir Akturk <cakturk@gmail.com>,
Souptick Joarder <jrdr.linux@gmail.com>
Subject: Re: [PATCH] drm/vgem: off by one in vgem_gem_fault()
Date: Tue, 03 Jul 2018 13:06:25 +0000 [thread overview]
Message-ID: <20180703130625.GD3891@phenom.ffwll.local> (raw)
In-Reply-To: <20180703122921.brlfxl4vx2ybvrd2@kili.mountain>
On Tue, Jul 03, 2018 at 03:29:21PM +0300, Dan Carpenter wrote:
> If page_offset is = num_pages then we end up reading beyond the end of
> obj->pages[].
>
> Fixes: af33a9190d02 ("drm/vgem: Enable dmabuf import interfaces")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> Static analysis. Not tested
Applied, thanks.
-Daniel
>
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> index c64a85950c82..0e5620f76ee0 100644
> --- a/drivers/gpu/drm/vgem/vgem_drv.c
> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -74,7 +74,7 @@ static vm_fault_t vgem_gem_fault(struct vm_fault *vmf)
>
> num_pages = DIV_ROUND_UP(obj->base.size, PAGE_SIZE);
>
> - if (page_offset > num_pages)
> + if (page_offset >= num_pages)
> return VM_FAULT_SIGBUS;
>
> mutex_lock(&obj->pages_lock);
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
prev parent reply other threads:[~2018-07-03 13:06 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-03 12:29 [PATCH] drm/vgem: off by one in vgem_gem_fault() Dan Carpenter
2018-07-03 13:06 ` Daniel Vetter [this message]
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=20180703130625.GD3891@phenom.ffwll.local \
--to=daniel@ffwll.ch \
--cc=airlied@linux.ie \
--cc=briannorris@chromium.org \
--cc=cakturk@gmail.com \
--cc=dan.carpenter@oracle.com \
--cc=daniel.vetter@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=jrdr.linux@gmail.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=willy@infradead.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