⬢ DragonFlyBSD Kernel Audit
DF-5187 / fix.diff
← back to finding ↓ download raw
--- a/sys/dev/drm/drm_gem.c
+++ b/sys/dev/drm/drm_gem.c
@@ -398,7 +398,11 @@ int drm_gem_dumb_map_offset(struct drm_file *file, struct drm_device *dev,
 	ret = drm_gem_create_mmap_offset(obj);
 	if (ret)
 		goto out;
 
-	*offset = drm_vma_node_offset_addr(&obj->vma_node);
+	/*
+	 * The DragonFly mmap resolver (drm_gem_object_from_offset,
+	 * drm_gem.c:1063-1080) understands only KEY|OFF(idxunr-key)
+	 * offsets — return that form, like i915_gem.c:2647-2648.
+	 */
+	*offset = DRM_GEM_MAPPING_OFF(obj->map_list.key) | DRM_GEM_MAPPING_KEY;
 out:
 	drm_gem_object_put_unlocked(obj);
 
 	return ret;