From: Ben Widawsky <benjamin.widawsky@intel.com>
To: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 2/2] drm/i915: Avoid dereference past end of page array in gen8_ppgtt_insert_entries()
Date: Wed, 1 Jan 2014 12:15:11 -0800 [thread overview]
Message-ID: <20140101201511.GD23858@intel.com> (raw)
In-Reply-To: <1388505031-29175-2-git-send-email-chris@chris-wilson.co.uk>
On Tue, Dec 31, 2013 at 03:50:31PM +0000, Chris Wilson wrote:
> The bug from gen6_ppgtt_insert_entries() was replicated into
> gen8_ppgtt_insert_entries(). This applies the fix for the OOPS from the
> previous patch to the gen8 routine.
>
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Ben Widawsky <benjamin.widawsky@intel.com>
Note to Daniel: This is still broken (for gen8) in the 4GB GGTT series.
There, pdpe is the bad guy.
Both are:
Reviewed-by: Ben Widawsky <ben@bwidawsk.net>
> ---
> drivers/gpu/drm/i915/i915_gem_gtt.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem_gtt.c b/drivers/gpu/drm/i915/i915_gem_gtt.c
> index 366ede6352db..2a26d739a962 100644
> --- a/drivers/gpu/drm/i915/i915_gem_gtt.c
> +++ b/drivers/gpu/drm/i915/i915_gem_gtt.c
> @@ -299,23 +299,23 @@ static void gen8_ppgtt_insert_entries(struct i915_address_space *vm,
> unsigned act_pte = first_entry % GEN8_PTES_PER_PAGE;
> struct sg_page_iter sg_iter;
>
> - pt_vaddr = kmap_atomic(&ppgtt->gen8_pt_pages[act_pt]);
> + pt_vaddr = NULL;
> for_each_sg_page(pages->sgl, &sg_iter, pages->nents, 0) {
> - dma_addr_t page_addr;
> + if (pt_vaddr == NULL)
> + pt_vaddr = kmap_atomic(&ppgtt->gen8_pt_pages[act_pt]);
>
> - page_addr = sg_dma_address(sg_iter.sg) +
> - (sg_iter.sg_pgoffset << PAGE_SHIFT);
> - pt_vaddr[act_pte] = gen8_pte_encode(page_addr, cache_level,
> - true);
> + pt_vaddr[act_pte] =
> + gen8_pte_encode(sg_page_iter_dma_address(&sg_iter),
> + cache_level, true);
> if (++act_pte == GEN8_PTES_PER_PAGE) {
> kunmap_atomic(pt_vaddr);
> + pt_vaddr = NULL;
> act_pt++;
> - pt_vaddr = kmap_atomic(&ppgtt->gen8_pt_pages[act_pt]);
> act_pte = 0;
> -
> }
> }
> - kunmap_atomic(pt_vaddr);
> + if (pt_vaddr)
> + kunmap_atomic(pt_vaddr);
> }
>
> static void gen8_ppgtt_cleanup(struct i915_address_space *vm)
> --
> 1.8.5.2
>
--
Ben Widawsky, Intel Open Source Technology Center
prev parent reply other threads:[~2014-01-01 20:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-31 15:50 [PATCH 1/2] drm/i915: Avoid dereference past end of page array in gen6_ppgtt_insert_entries() Chris Wilson
2013-12-31 15:50 ` [PATCH 2/2] drm/i915: Avoid dereference past end of page array in gen8_ppgtt_insert_entries() Chris Wilson
2014-01-01 20:15 ` Ben Widawsky [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=20140101201511.GD23858@intel.com \
--to=benjamin.widawsky@intel.com \
--cc=chris@chris-wilson.co.uk \
--cc=daniel.vetter@ffwll.ch \
--cc=intel-gfx@lists.freedesktop.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 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.