]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/imagination: Disallow exporting of PM/FW protected objects
authorAlessio Belle <alessio.belle@imgtec.com>
Mon, 8 Dec 2025 09:11:00 +0000 (09:11 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:14:55 +0000 (10:14 +0100)
commit 6b991ad8dc3abfe5720fc2e9ee96be63ae43e362 upstream.

These objects are meant to be used by the GPU firmware or by the PM unit
within the GPU, in which case they may contain physical addresses.

This adds a layer of protection against exposing potentially exploitable
information outside of the driver.

Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Alessio Belle <alessio.belle@imgtec.com>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20251208-no-export-pm-fw-obj-v1-1-83ab12c61693@imgtec.com
Signed-off-by: Matt Coster <matt.coster@imgtec.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/imagination/pvr_gem.c

index 6a8c81fe8c1e85c2130a4fe90fce35b6a2be35aa..59e7bbe64a3f66c38e39c7c49d25cfd88f3b180c 100644 (file)
@@ -27,6 +27,16 @@ static void pvr_gem_object_free(struct drm_gem_object *obj)
        drm_gem_shmem_object_free(obj);
 }
 
+static struct dma_buf *pvr_gem_export(struct drm_gem_object *obj, int flags)
+{
+       struct pvr_gem_object *pvr_obj = gem_to_pvr_gem(obj);
+
+       if (pvr_obj->flags & DRM_PVR_BO_PM_FW_PROTECT)
+               return ERR_PTR(-EPERM);
+
+       return drm_gem_prime_export(obj, flags);
+}
+
 static int pvr_gem_mmap(struct drm_gem_object *gem_obj, struct vm_area_struct *vma)
 {
        struct pvr_gem_object *pvr_obj = gem_to_pvr_gem(gem_obj);
@@ -41,6 +51,7 @@ static int pvr_gem_mmap(struct drm_gem_object *gem_obj, struct vm_area_struct *v
 static const struct drm_gem_object_funcs pvr_gem_object_funcs = {
        .free = pvr_gem_object_free,
        .print_info = drm_gem_shmem_object_print_info,
+       .export = pvr_gem_export,
        .pin = drm_gem_shmem_object_pin,
        .unpin = drm_gem_shmem_object_unpin,
        .get_sg_table = drm_gem_shmem_object_get_sg_table,