diff options
| author | Imre Deak <imre.deak@intel.com> | 2013-04-18 21:11:56 -0400 |
|---|---|---|
| committer | Dave Airlie <airlied@redhat.com> | 2013-04-30 19:40:21 -0400 |
| commit | 011c2282c74db120f01a8414edc66c3f217f5511 (patch) | |
| tree | 5e43eb6b5d21e8aa29e88f0398fcdd7ca55abdb5 /drivers/gpu/drm/udl | |
| parent | 219b47339ced80ca580bb6ce7d1636166984afa7 (diff) | |
drm: prime: fix refcounting on the dmabuf import error path
In commit be8a42ae60 we inroduced a refcount problem, where on the
drm_gem_prime_fd_to_handle() error path we'll call dma_buf_put() for
self imported dma buffers.
Fix this by taking a reference on the dma buffer in the .gem_import
hook instead of assuming the caller had taken one. Besides fixing the
bug this is also more logical.
Signed-off-by: Imre Deak <imre.deak@intel.com>
Cc: stable@vger.kernel.org
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/udl')
| -rw-r--r-- | drivers/gpu/drm/udl/udl_gem.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/udl/udl_gem.c b/drivers/gpu/drm/udl/udl_gem.c index 3816270ba49b..ef034fa3e6f5 100644 --- a/drivers/gpu/drm/udl/udl_gem.c +++ b/drivers/gpu/drm/udl/udl_gem.c | |||
| @@ -303,6 +303,8 @@ struct drm_gem_object *udl_gem_prime_import(struct drm_device *dev, | |||
| 303 | if (IS_ERR(attach)) | 303 | if (IS_ERR(attach)) |
| 304 | return ERR_CAST(attach); | 304 | return ERR_CAST(attach); |
| 305 | 305 | ||
| 306 | get_dma_buf(dma_buf); | ||
| 307 | |||
| 306 | sg = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); | 308 | sg = dma_buf_map_attachment(attach, DMA_BIDIRECTIONAL); |
| 307 | if (IS_ERR(sg)) { | 309 | if (IS_ERR(sg)) { |
| 308 | ret = PTR_ERR(sg); | 310 | ret = PTR_ERR(sg); |
| @@ -322,5 +324,7 @@ fail_unmap: | |||
| 322 | dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL); | 324 | dma_buf_unmap_attachment(attach, sg, DMA_BIDIRECTIONAL); |
| 323 | fail_detach: | 325 | fail_detach: |
| 324 | dma_buf_detach(dma_buf, attach); | 326 | dma_buf_detach(dma_buf, attach); |
| 327 | dma_buf_put(dma_buf); | ||
| 328 | |||
| 325 | return ERR_PTR(ret); | 329 | return ERR_PTR(ret); |
| 326 | } | 330 | } |
