diff options
author | YoungJun Cho <yj44.cho@samsung.com> | 2013-06-26 10:21:40 +0900 |
---|---|---|
committer | Chanho Park <chanho61.park@samsung.com> | 2014-11-21 19:12:23 +0900 |
commit | b2ddf4610f5c39025bcbc8ef1be2e0785eb8e53d (patch) | |
tree | 3505c1611566a24e59716a96627c4ed443072639 /drivers/gpu | |
parent | ca3561faf31ab329074eb795f2f7c8a2a19ae430 (diff) | |
download | linux-3.10-b2ddf4610f5c39025bcbc8ef1be2e0785eb8e53d.tar.gz linux-3.10-b2ddf4610f5c39025bcbc8ef1be2e0785eb8e53d.tar.bz2 linux-3.10-b2ddf4610f5c39025bcbc8ef1be2e0785eb8e53d.zip |
drm/prime: fix to put an exported dma_buf for adding handle failure
When drm_prime_add_buf_handle() returns failure for an exported
dma_buf, the dma_buf was already allocated and its refcount was
increased, so it needs to be put.
Signed-off-by: YoungJun Cho <yj44.cho@samsung.com>
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/drm_prime.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c index a61266bc79f..a633b14e33d 100644 --- a/drivers/gpu/drm/drm_prime.c +++ b/drivers/gpu/drm/drm_prime.c @@ -307,7 +307,7 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, ret = drm_prime_add_buf_handle(&file_priv->prime, obj->export_dma_buf, handle); if (ret) - goto out; + goto fail_put_dmabuf; *prime_fd = dma_buf_fd(buf, flags); mutex_unlock(&file_priv->prime.lock); @@ -316,6 +316,12 @@ int drm_gem_prime_handle_to_fd(struct drm_device *dev, out_have_obj: get_dma_buf(dmabuf); *prime_fd = dma_buf_fd(dmabuf, flags); + goto out; + +fail_put_dmabuf: + /* clear NOT to be checked when releasing dma_buf */ + obj->export_dma_buf = NULL; + dma_buf_put(buf); out: drm_gem_object_unreference_unlocked(obj); mutex_unlock(&file_priv->prime.lock); |