drm/imagination: vm: Fix heap lookup condition
authorAlex Bee <knaerzche@gmail.com>
Fri, 8 Dec 2023 17:08:56 +0000 (18:08 +0100)
committerMaxime Ripard <mripard@kernel.org>
Wed, 13 Dec 2023 15:19:01 +0000 (16:19 +0100)
When conditionally checking for heap existence of a certian address in
pvr_vm_bind_op_map_init the condition whether the map request comes from a
user is incorrect: The context must not be the kernel-context to be a
user(space) context and should be looked up in pvr_heaps.

That makes addresses coming from userspace not being verfied against the
defined ranges and prevents firmware loading for meta cores.

Fixes: ff5f643de0bf ("drm/imagination: Add GEM and VM related code")
Signed-off-by: Alex Bee <knaerzche@gmail.com>
Reviewed-by: Donald Robson <donald.robson@imgtec.com>
Signed-off-by: Maxime Ripard <mripard@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20231208170856.1748413-1-knaerzche@gmail.com
drivers/gpu/drm/imagination/pvr_vm.c

index f42345fbe4bf9183dd4b143b465514d554f072e8..82690cee978c407a68ef7cda75b60c357084e631 100644 (file)
@@ -225,7 +225,7 @@ pvr_vm_bind_op_map_init(struct pvr_vm_bind_op *bind_op,
                        u64 device_addr, u64 size)
 {
        struct drm_gem_object *obj = gem_from_pvr_gem(pvr_obj);
-       const bool is_user = vm_ctx == vm_ctx->pvr_dev->kernel_vm_ctx;
+       const bool is_user = vm_ctx != vm_ctx->pvr_dev->kernel_vm_ctx;
        const u64 pvr_obj_size = pvr_gem_object_size(pvr_obj);
        struct sg_table *sgt;
        u64 offset_plus_size;