diff options
author | Melissa Wen <mwen@igalia.com> | 2022-12-05 16:55:37 +0300 |
---|---|---|
committer | Melissa Wen <melissa.srw@gmail.com> | 2022-12-19 03:08:19 +0300 |
commit | f98c5ec25162fbb019212c64cdd3bfde8af1fac7 (patch) | |
tree | e2d5628cf7a51314556f4f8e8df04000407bd314 /drivers | |
parent | 4b6cb2b67da883bc5095ee6d77f951f1cd7a1c24 (diff) | |
download | linux-f98c5ec25162fbb019212c64cdd3bfde8af1fac7.tar.xz |
drm/v3d: cleanup BOs properly when lookup_bos fails
When v3d_lookup_bos fails to `allocate validated BO pointers`,
job->bo_count was already set to args->bo_count, but job->bo points to
NULL. In this scenario, we must verify that job->bo is not NULL before
iterating on it to proper clean up a job. Also, drm_gem_object_put
already checks that the object passed is not NULL, doing the job->bo[i]
checker redundant.
Signed-off-by: Melissa Wen <mwen@igalia.com>
Reviewed-by: MaĆra Canal <mcanal@igalia.com>
Signed-off-by: Melissa Wen <melissa.srw@gmail.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221205135538.3545051-2-mwen@igalia.com
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/v3d/v3d_gem.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/v3d/v3d_gem.c b/drivers/gpu/drm/v3d/v3d_gem.c index 96af1cb5202a..31a37572c11d 100644 --- a/drivers/gpu/drm/v3d/v3d_gem.c +++ b/drivers/gpu/drm/v3d/v3d_gem.c @@ -363,11 +363,11 @@ v3d_job_free(struct kref *ref) struct v3d_job *job = container_of(ref, struct v3d_job, refcount); int i; - for (i = 0; i < job->bo_count; i++) { - if (job->bo[i]) + if (job->bo) { + for (i = 0; i < job->bo_count; i++) drm_gem_object_put(job->bo[i]); + kvfree(job->bo); } - kvfree(job->bo); dma_fence_put(job->irq_fence); dma_fence_put(job->done_fence); |