Skip to content

Commit 00b3401

Browse files
robclarkgregkh
authored andcommitted
drm/msm: Fix another leak in the submit error path
[ Upstream commit f681c2aa8676a890eacc84044717ab0fd26e058f ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 201eba5 commit 00b3401

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
@@ -724,6 +724,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
724724
struct msm_ringbuffer *ring;
725725
struct msm_submit_post_dep *post_deps = NULL;
726726
struct drm_syncobj **syncobjs_to_reset = NULL;
727+
struct sync_file *sync_file = NULL;
727728
int out_fence_fd = -1;
728729
bool has_ww_ticket = false;
729730
unsigned i;
@@ -927,7 +928,7 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
927928
}
928929

929930
if (ret == 0 && args->flags & MSM_SUBMIT_FENCE_FD_OUT) {
930-
struct sync_file *sync_file = sync_file_create(submit->user_fence);
931+
sync_file = sync_file_create(submit->user_fence);
931932
if (!sync_file) {
932933
ret = -ENOMEM;
933934
} else {
@@ -958,8 +959,11 @@ int msm_ioctl_gem_submit(struct drm_device *dev, void *data,
958959
out_unlock:
959960
mutex_unlock(&queue->lock);
960961
out_post_unlock:
961-
if (ret && (out_fence_fd >= 0))
962+
if (ret && (out_fence_fd >= 0)) {
962963
put_unused_fd(out_fence_fd);
964+
if (sync_file)
965+
fput(sync_file->file);
966+
}
963967

964968
if (!IS_ERR_OR_NULL(submit)) {
965969
msm_gem_submit_put(submit);

0 commit comments

Comments
 (0)