diff options
| author | 2023-07-31 09:39:56 +0200 | |
|---|---|---|
| committer | 2023-07-31 09:39:56 +0200 | |
| commit | fe3015748a905e08eb0e1750aa2928f520063d59 (patch) | |
| tree | d15524d1f7931e8e5964e9ff8368792d09282da5 /drivers/gpu/drm/msm/msm_gem_submit.c | |
| parent | parport_pc: add support for ASIX AX99100 (diff) | |
| parent | Linux 6.5-rc4 (diff) | |
| download | wireguard-linux-fe3015748a905e08eb0e1750aa2928f520063d59.tar.xz wireguard-linux-fe3015748a905e08eb0e1750aa2928f520063d59.zip | |
Merge 6.5-rc4 into tty-next
We need the serial/tty fixes in here as well for testing and future
development.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/gpu/drm/msm/msm_gem_submit.c')
| -rw-r--r-- | drivers/gpu/drm/msm/msm_gem_submit.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c b/drivers/gpu/drm/msm/msm_gem_submit.c index 3f1aa4de3b87..63c96416e183 100644 --- a/drivers/gpu/drm/msm/msm_gem_submit.c +++ b/drivers/gpu/drm/msm/msm_gem_submit.c @@ -86,7 +86,19 @@ void __msm_gem_submit_destroy(struct kref *kref) } dma_fence_put(submit->user_fence); - dma_fence_put(submit->hw_fence); + + /* + * If the submit is freed before msm_job_run(), then hw_fence is + * just some pre-allocated memory, not a reference counted fence. + * Once the job runs and the hw_fence is initialized, it will + * have a refcount of at least one, since the submit holds a ref + * to the hw_fence. + */ + if (kref_read(&submit->hw_fence->refcount) == 0) { + kfree(submit->hw_fence); + } else { + dma_fence_put(submit->hw_fence); + } put_pid(submit->pid); msm_submitqueue_put(submit->queue); @@ -889,7 +901,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, * after the job is armed */ if ((args->flags & MSM_SUBMIT_FENCE_SN_IN) && - idr_find(&queue->fence_idr, args->fence)) { + (!args->fence || idr_find(&queue->fence_idr, args->fence))) { spin_unlock(&queue->idr_lock); idr_preload_end(); ret = -EINVAL; |
