Skip to content
Snippets Groups Projects
Commit 97b67847 authored by Andi Shyti's avatar Andi Shyti Committed by Joonas Lahtinen
Browse files

drm/i915/gem: Fix Virtual Memory mapping boundaries calculation


Calculating the size of the mapped area as the lesser value
between the requested size and the actual size does not consider
the partial mapping offset. This can cause page fault access.

Fix the calculation of the starting and ending addresses, the
total size is now deduced from the difference between the end and
start addresses.

Additionally, the calculations have been rewritten in a clearer
and more understandable form.

Fixes: c58305af ("drm/i915: Use remap_io_mapping() to prefault all PTE in a single pass")
Reported-by: default avatarJann Horn <jannh@google.com>
Co-developed-by: default avatarChris Wilson <chris.p.wilson@linux.intel.com>
Signed-off-by: default avatarChris Wilson <chris.p.wilson@linux.intel.com>
Signed-off-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Matthew Auld <matthew.auld@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: <stable@vger.kernel.org> # v4.9+
Reviewed-by: default avatarJann Horn <jannh@google.com>
Reviewed-by: default avatarJonathan Cavitt <Jonathan.cavitt@intel.com>
[Joonas: Add Requires: tag]
Requires: 60a2066c ("drm/i915/gem: Adjust vma offset for framebuffer mmap offset")
Signed-off-by: default avatarJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240802083850.103694-3-andi.shyti@linux.intel.com
parent 60a2066c
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment