Commit 3596770b authored by Thomas Hellstrom's avatar Thomas Hellstrom Committed by Sasha Levin

drm/ttm: Fix accesses through vmas with only partial coverage

VMAs covering a bo but that didn't start at the same address space offset as
the bo they were mapping were incorrectly generating SEGFAULT errors in
the fault handler.
Reported-by: default avatarJoseph Dolinak <kanilo2@yahoo.com>
Signed-off-by: default avatarThomas Hellstrom <thellstrom@vmware.com>
Reviewed-by: default avatarJakob Bornecrantz <jakob@vmware.com>
Cc: stable@vger.kernel.org

(cherry picked from commit d3867355)
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
parent 143b1c74
......@@ -146,9 +146,9 @@ static int ttm_bo_vm_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
}
page_offset = ((address - vma->vm_start) >> PAGE_SHIFT) +
bo->vm_node->start - vma->vm_pgoff;
page_last = ((vma->vm_end - vma->vm_start) >> PAGE_SHIFT) +
bo->vm_node->start - vma->vm_pgoff;
vma->vm_pgoff - bo->vm_node->start;
page_last = vma_pages(vma) + vma->vm_pgoff -
bo->vm_node->start;
if (unlikely(page_offset >= bo->num_pages)) {
retval = VM_FAULT_SIGBUS;
......
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