Commit 4a88f73f authored by Daniel Vetter's avatar Daniel Vetter Committed by Dave Airlie

drm/prime: fix up handle_to_fd ioctl return value

In

commit da34242e
Author: YoungJun Cho <yj44.cho@samsung.com>
Date:   Wed Jun 26 10:21:42 2013 +0900

    drm/prime: add return check for dma_buf_fd

the failure case handling was fixed up. But in the case when we
already had the buffer exported it changed the return value:
Previously we've return 0 on success, now we return the fd.

This ABI change has been caught by i-g-t/prime_self_import/with_one_bo.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=66436
Cc: YoungJun Cho <yj44.cho@samsung.com>
Cc: Seung-Woo Kim <sw0312.kim@samsung.com>
Cc: Kyungmin Park <kyungmin.park@samsung.com>
Tested-by: default avatarlu hua <huax.lu@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Reviewed-by: default avatarYoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 77ef8bbc
......@@ -347,10 +347,13 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev,
out_have_obj:
get_dma_buf(dmabuf);
ret = dma_buf_fd(dmabuf, flags);
if (ret < 0)
if (ret < 0) {
dma_buf_put(dmabuf);
else
} else {
*prime_fd = ret;
ret = 0;
}
goto out;
fail_rm_handle:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment