Skip to content

Commit

Permalink
drm/i915: Assert we do not overflow 4lvl page directories
Browse files Browse the repository at this point in the history
Before looking up the page directory entry, check we are still within
bounds.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: Matthew Auld <matthew.william.auld@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170225181122.4788-2-chris@chris-wilson.co.uk
  • Loading branch information
Chris Wilson committed Feb 25, 2017
1 parent b3bb828 commit 357480c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/gpu/drm/i915/i915_gem_gtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -830,6 +830,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,
gen8_pte_t *vaddr;
bool ret;

GEM_BUG_ON(pdpe >= I915_PDPES_PER_PDP(vm));
pd = pdp->page_directory[pdpe];
vaddr = kmap_atomic_px(pd->page_table[pde]);
do {
Expand All @@ -854,8 +855,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,
break;
}

GEM_BUG_ON(!i915_vm_is_48bit(&ppgtt->base) &&
pdpe >= GEN8_LEGACY_PDPES);
GEM_BUG_ON(pdpe >= I915_PDPES_PER_PDP(vm));
pd = pdp->page_directory[pdpe];
pde = 0;
}
Expand Down Expand Up @@ -904,7 +904,7 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm,

while (gen8_ppgtt_insert_pte_entries(ppgtt, pdps[pml4e++], &iter,
start, cache_level))
;
GEM_BUG_ON(pml4e >= GEN8_PML4ES_PER_PML4);
}

static void gen8_free_page_tables(struct i915_address_space *vm,
Expand Down

0 comments on commit 357480c

Please sign in to comment.