Commit 357480ce authored by Chris Wilson's avatar Chris Wilson

drm/i915: Assert we do not overflow 4lvl page directories

Before looking up the page directory entry, check we are still within
bounds.
Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: Matthew Auld <matthew.william.auld@gmail.com>
Reviewed-by: default avatarMatthew Auld <matthew.william.auld@gmail.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20170225181122.4788-2-chris@chris-wilson.co.uk
parent b3bb8288
...@@ -830,6 +830,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt, ...@@ -830,6 +830,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,
gen8_pte_t *vaddr; gen8_pte_t *vaddr;
bool ret; bool ret;
GEM_BUG_ON(pdpe >= I915_PDPES_PER_PDP(vm));
pd = pdp->page_directory[pdpe]; pd = pdp->page_directory[pdpe];
vaddr = kmap_atomic_px(pd->page_table[pde]); vaddr = kmap_atomic_px(pd->page_table[pde]);
do { do {
...@@ -854,8 +855,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt, ...@@ -854,8 +855,7 @@ gen8_ppgtt_insert_pte_entries(struct i915_hw_ppgtt *ppgtt,
break; break;
} }
GEM_BUG_ON(!i915_vm_is_48bit(&ppgtt->base) && GEM_BUG_ON(pdpe >= I915_PDPES_PER_PDP(vm));
pdpe >= GEN8_LEGACY_PDPES);
pd = pdp->page_directory[pdpe]; pd = pdp->page_directory[pdpe];
pde = 0; pde = 0;
} }
...@@ -904,7 +904,7 @@ static void gen8_ppgtt_insert_4lvl(struct i915_address_space *vm, ...@@ -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, while (gen8_ppgtt_insert_pte_entries(ppgtt, pdps[pml4e++], &iter,
start, cache_level)) start, cache_level))
; GEM_BUG_ON(pml4e >= GEN8_PML4ES_PER_PML4);
} }
static void gen8_free_page_tables(struct i915_address_space *vm, static void gen8_free_page_tables(struct i915_address_space *vm,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment