Skip to content

Commit f681c2a

Browse files
robclarkRob Clark
authored andcommitted
drm/msm: Fix another leak in the submit error path
put_unused_fd() doesn't free the installed file, if we've already done fd_install(). So we need to also free the sync_file. Signed-off-by: Rob Clark <[email protected]> Patchwork: https://patchwork.freedesktop.org/patch/653583/ Signed-off-by: Rob Clark <[email protected]>
1 parent 5d319f7 commit f681c2a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/gpu/drm/msm/msm_gem_submit.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
658658
struct msm_ringbuffer *ring;
659659
struct msm_submit_post_dep *post_deps = NULL;
660660
struct drm_syncobj **syncobjs_to_reset = NULL;
661+
struct sync_file *sync_file = NULL;
661662
int out_fence_fd = -1;
662663
unsigned i;
663664
int ret;
@@ -867,7 +868,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
867868
}
868869

869870
if (ret == 0 && args->flags & MSM_SUBMIT_FENCE_FD_OUT) {
870-
struct sync_file *sync_file = sync_file_create(submit->user_fence);
871+
sync_file = sync_file_create(submit->user_fence);
871872
if (!sync_file) {
872873
ret = -ENOMEM;
873874
} else {
@@ -901,8 +902,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
901902
out_unlock:
902903
mutex_unlock(&queue->lock);
903904
out_post_unlock:
904-
if (ret && (out_fence_fd >= 0))
905+
if (ret && (out_fence_fd >= 0)) {
905906
put_unused_fd(out_fence_fd);
907+
if (sync_file)
908+
fput(sync_file->file);
909+
}
906910

907911
if (!IS_ERR_OR_NULL(submit)) {
908912
msm_gem_submit_put(submit);

0 commit comments

Comments
 (0)