Skip to content

Commit

Permalink
msm: kgsl: fix sync file error handling
Browse files Browse the repository at this point in the history
We need to call put_unused_fd() on failure, but only if
a file hasn't been stored into the fd yet. This function
wasn't called from kgsl_ioctl_syncsource_create_fence()
and was called incorrectly from kgsl_add_fence_event().
Reorder our sync_fence_install() calls to happen after
all possible failures so that error cleanup will be
correct.

Bug: 32125137
Change-Id: I57a75447d1a430de7e5a93d5cd103269fc0b1e15
Signed-off-by: Jeremy Gebben <[email protected]>
Signed-off-by: Francisco Franco <[email protected]>
  • Loading branch information
jgebben authored and franciscofranco committed Nov 7, 2017
1 parent 582570d commit 683f3e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/msm/kgsl_sync.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,6 @@ int kgsl_add_fence_event(struct kgsl_device *device,
ret = -EINVAL;
goto fail_fd;
}
sync_fence_install(fence, priv.fence_fd);

if (copy_to_user(data, &priv, sizeof(priv))) {
ret = -EFAULT;
Expand All @@ -169,6 +168,8 @@ int kgsl_add_fence_event(struct kgsl_device *device,
if (ret)
goto fail_event;

sync_fence_install(fence, priv.fence_fd);

return 0;

fail_event:
Expand Down

0 comments on commit 683f3e4

Please sign in to comment.