On Tue, Aug 13, 2024 at 04:14:36PM +0200, Andi Shyti wrote: > Commit 8bdd9ef7e9b1b2a73e394712b72b22055e0e26c3 upstream. > > 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: c58305af1835 ("drm/i915: Use remap_io_mapping() to prefault all PTE in a single pass") > Reported-by: Jann Horn <jannh@xxxxxxxxxx> > Co-developed-by: Chris Wilson <chris.p.wilson@xxxxxxxxxxxxxxx> > Signed-off-by: Chris Wilson <chris.p.wilson@xxxxxxxxxxxxxxx> > Signed-off-by: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx> > Cc: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > Cc: Matthew Auld <matthew.auld@xxxxxxxxx> > Cc: Rodrigo Vivi <rodrigo.vivi@xxxxxxxxx> > Cc: <stable@xxxxxxxxxxxxxxx> # v4.9+ > Reviewed-by: Jann Horn <jannh@xxxxxxxxxx> > Reviewed-by: Jonathan Cavitt <Jonathan.cavitt@xxxxxxxxx> > [Joonas: Add Requires: tag] > Requires: 60a2066c5005 ("drm/i915/gem: Adjust vma offset for framebuffer mmap offset") > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > Link: https://patchwork.freedesktop.org/patch/msgid/20240802083850.103694-3-andi.shyti@xxxxxxxxxxxxxxx > (cherry picked from commit 97b6784753da06d9d40232328efc5c5367e53417) > Signed-off-by: Joonas Lahtinen <joonas.lahtinen@xxxxxxxxxxxxxxx> > --- > drivers/gpu/drm/i915/i915_gem.c | 48 +++++++++++++++++++++++++++++---- > 1 file changed, 43 insertions(+), 5 deletions(-) Both now applied, thanks. greg k-h