drm/i915/gem: add missing boundary check in vm_access
authorjsg <jsg@openbsd.org>
Mon, 11 Apr 2022 03:38:46 +0000 (03:38 +0000)
committerjsg <jsg@openbsd.org>
Mon, 11 Apr 2022 03:38:46 +0000 (03:38 +0000)
From Mastan Katragadda
312d3d4f49e12f97260bcf972c848c3562126a18 in linux 5.15.y/5.15.33
3886a86e7e6cc6ce2ce93c440fecd8f42aed0ce7 in mainline linux

sys/dev/pci/drm/i915/gem/i915_gem_mman.c

index 2607a4f..330cb25 100644 (file)
@@ -473,7 +473,7 @@ vm_access(struct vm_area_struct *area, unsigned long addr,
                return -EACCES;
 
        addr -= area->vm_start;
-       if (addr >= obj->base.size)
+       if (range_overflows_t(u64, addr, len, obj->base.size))
                return -EINVAL;
 
        i915_gem_ww_ctx_init(&ww, true);