Message ID | 1362098606-26469-17-git-send-email-john.stultz@linaro.org |
---|---|
State | Accepted |
Commit | 92ea915adb5565b522902a7b3f0a33ede16bb797 |
Headers | show |
diff --git a/drivers/staging/android/sync.c b/drivers/staging/android/sync.c index 61c27bd..c4a3c1d 100644 --- a/drivers/staging/android/sync.c +++ b/drivers/staging/android/sync.c @@ -647,8 +647,13 @@ static long sync_fence_ioctl_merge(struct sync_fence *fence, unsigned long arg) struct sync_fence *fence2, *fence3; struct sync_merge_data data; - if (copy_from_user(&data, (void __user *)arg, sizeof(data))) - return -EFAULT; + if (fd < 0) + return fd; + + if (copy_from_user(&data, (void __user *)arg, sizeof(data))) { + err = -EFAULT; + goto err_put_fd; + } fence2 = sync_fence_fdget(data.fd2); if (fence2 == NULL) {