]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/xe: fix error handling in xe_migrate_update_pgtables
authorMatthew Auld <matthew.auld@intel.com>
Thu, 20 Jun 2024 10:20:26 +0000 (11:20 +0100)
committerThomas Hellström <thomas.hellstrom@linux.intel.com>
Thu, 4 Jul 2024 08:36:20 +0000 (10:36 +0200)
Don't call drm_suballoc_free with sa_bo pointing to PTR_ERR.

References: https://gitlab.freedesktop.org/drm/xe/kernel/-/issues/2120
Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs")
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Matthew Brost <matthew.brost@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
Reviewed-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240620102025.127699-2-matthew.auld@intel.com
(cherry picked from commit ce6b63336f79ec5f3996de65f452330e395f99ae)
Signed-off-by: Thomas Hellström <thomas.hellstrom@linux.intel.com>
drivers/gpu/drm/xe/xe_migrate.c

index 65e5a3f4c340f0f6bb3597f94efc099d9ff23e26..198f5c2189cb4b47f3622bf3d9e62d2dbd05ee58 100644 (file)
@@ -1334,7 +1334,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
                                                 GFP_KERNEL, true, 0);
                        if (IS_ERR(sa_bo)) {
                                err = PTR_ERR(sa_bo);
-                               goto err;
+                               goto err_bb;
                        }
 
                        ppgtt_ofs = NUM_KERNEL_PDE +
@@ -1385,7 +1385,7 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
                                         update_idx);
        if (IS_ERR(job)) {
                err = PTR_ERR(job);
-               goto err_bb;
+               goto err_sa;
        }
 
        /* Wait on BO move */
@@ -1434,12 +1434,12 @@ xe_migrate_update_pgtables(struct xe_migrate *m,
 
 err_job:
        xe_sched_job_put(job);
+err_sa:
+       drm_suballoc_free(sa_bo, NULL);
 err_bb:
        if (!q)
                mutex_unlock(&m->job_mutex);
        xe_bb_free(bb, NULL);
-err:
-       drm_suballoc_free(sa_bo, NULL);
        return ERR_PTR(err);
 }