drm/v3d: don't leak bin job if v3d_job_init fails.
authorIago Toral Quiroga <itoral@igalia.com>
Mon, 16 Sep 2019 07:11:25 +0000 (09:11 +0200)
committerEric Anholt <eric@anholt.net>
Wed, 18 Sep 2019 17:30:44 +0000 (10:30 -0700)
If the initialization of the job fails we need to kfree() it
before returning.

Signed-off-by: Iago Toral Quiroga <itoral@igalia.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20190916071125.5255-1-itoral@igalia.com
Fixes: a783a09ee76d ("drm/v3d: Refactor job management.")
Reviewed-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/v3d/v3d_gem.c

index 5d80507..fb32cda 100644 (file)
@@ -563,6 +563,7 @@ v3d_submit_cl_ioctl(struct drm_device *dev, void *data,
                ret = v3d_job_init(v3d, file_priv, &bin->base,
                                   v3d_job_free, args->in_sync_bcl);
                if (ret) {
+                       kfree(bin);
                        v3d_job_put(&render->base);
                        return ret;
                }