]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/xe/queue: fix engine_class bounds check
authorMatthew Auld <matthew.auld@intel.com>
Mon, 18 Mar 2024 18:05:33 +0000 (18:05 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 10 Apr 2024 14:37:56 +0000 (16:37 +0200)
[ Upstream commit b7dce525c4fcc92b373136288309f8c9ca6c375f ]

The engine_class is the index into the user_to_xe_engine_class,
therefore it needs to be less than.

Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Nirmoy Das <nirmoy.das@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240318180532.57522-4-matthew.auld@intel.com
(cherry picked from commit fe87b7dfcb204a161d1e38b0e787b2f5ab520f32)
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/xe/xe_exec_queue.c

index a176d9ad6d1b8fb8f64b93a0f80c8186aea84133..5093c56d60ab62091b813d948c2a9363bbf9a3a0 100644 (file)
@@ -405,7 +405,7 @@ find_hw_engine(struct xe_device *xe,
 {
        u32 idx;
 
-       if (eci.engine_class > ARRAY_SIZE(user_to_xe_engine_class))
+       if (eci.engine_class >= ARRAY_SIZE(user_to_xe_engine_class))
                return NULL;
 
        if (eci.gt_id >= xe->info.gt_count)