Skip to content
Snippets Groups Projects
Verified Commit b7717153 authored by Robert Foss's avatar Robert Foss
Browse files

drm/msm: Move fence put to where failure occurs


If dma_fence_wait fails to wait for a supplied in-fence in
msm_ioctl_gem_submit, make sure we release that in-fence.

Also remove this dma_fence_put() from the 'out' label.

Signed-off-by: default avatarRobert Foss <robert.foss@collabora.com>
Reviewed-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
parent 5ff1ad55
No related tags found
No related merge requests found
...@@ -403,7 +403,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -403,7 +403,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
struct msm_file_private *ctx = file->driver_priv; struct msm_file_private *ctx = file->driver_priv;
struct msm_gem_submit *submit; struct msm_gem_submit *submit;
struct msm_gpu *gpu = priv->gpu; struct msm_gpu *gpu = priv->gpu;
struct dma_fence *in_fence = NULL;
struct sync_file *sync_file = NULL; struct sync_file *sync_file = NULL;
int out_fence_fd = -1; int out_fence_fd = -1;
unsigned i; unsigned i;
...@@ -422,6 +421,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -422,6 +421,8 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
return -EINVAL; return -EINVAL;
if (args->flags & MSM_SUBMIT_FENCE_FD_IN) { if (args->flags & MSM_SUBMIT_FENCE_FD_IN) {
struct dma_fence *in_fence;
in_fence = sync_file_get_fence(args->fence_fd); in_fence = sync_file_get_fence(args->fence_fd);
if (!in_fence) if (!in_fence)
...@@ -431,12 +432,14 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -431,12 +432,14 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
* Wait if the fence is from a foreign context, or if the fence * Wait if the fence is from a foreign context, or if the fence
* array contains any fence from a foreign context. * array contains any fence from a foreign context.
*/ */
if (!dma_fence_match_context(in_fence, gpu->fctx->context)) { ret = 0;
if (!dma_fence_match_context(in_fence, gpu->fctx->context))
ret = dma_fence_wait(in_fence, true); ret = dma_fence_wait(in_fence, true);
dma_fence_put(in_fence);
if (ret) if (ret)
return ret; return ret;
} }
}
ret = mutex_lock_interruptible(&dev->struct_mutex); ret = mutex_lock_interruptible(&dev->struct_mutex);
if (ret) if (ret)
...@@ -559,8 +562,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data, ...@@ -559,8 +562,6 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
} }
out: out:
if (in_fence)
dma_fence_put(in_fence);
submit_cleanup(submit); submit_cleanup(submit);
if (ret) if (ret)
msm_gem_submit_free(submit); msm_gem_submit_free(submit);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment