diff options
author | Boris Brezillon <boris.brezillon@collabora.com> | 2019-11-29 14:59:03 +0100 |
---|---|---|
committer | Rob Herring <robh@kernel.org> | 2019-12-06 11:06:11 -0600 |
commit | 3bb69dbcb9e8430e0cc9990cff427ca3ae25ffdc (patch) | |
tree | d59ca9c29151ac6eb71769c8fc0000cf175d106b /drivers/gpu/drm/panfrost | |
parent | 70cc77952efebf6722d483cb83cfb563ac9768db (diff) | |
download | linux-3bb69dbcb9e8430e0cc9990cff427ca3ae25ffdc.tar.gz linux-3bb69dbcb9e8430e0cc9990cff427ca3ae25ffdc.tar.bz2 linux-3bb69dbcb9e8430e0cc9990cff427ca3ae25ffdc.zip |
drm/panfrost: Fix a BO leak in panfrost_ioctl_mmap_bo()
We should release the reference we grabbed when an error occurs.
Fixes: 187d2929206e ("drm/panfrost: Add support for GPU heap allocations")
Cc: <stable@vger.kernel.org>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Acked-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20191129135908.2439529-4-boris.brezillon@collabora.com
Diffstat (limited to 'drivers/gpu/drm/panfrost')
-rw-r--r-- | drivers/gpu/drm/panfrost/panfrost_drv.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c index 8b8d6546cfac..0a5d82078bc8 100644 --- a/drivers/gpu/drm/panfrost/panfrost_drv.c +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c @@ -303,14 +303,17 @@ static int panfrost_ioctl_mmap_bo(struct drm_device *dev, void *data, } /* Don't allow mmapping of heap objects as pages are not pinned. */ - if (to_panfrost_bo(gem_obj)->is_heap) - return -EINVAL; + if (to_panfrost_bo(gem_obj)->is_heap) { + ret = -EINVAL; + goto out; + } ret = drm_gem_create_mmap_offset(gem_obj); if (ret == 0) args->offset = drm_vma_node_offset_addr(&gem_obj->vma_node); - drm_gem_object_put_unlocked(gem_obj); +out: + drm_gem_object_put_unlocked(gem_obj); return ret; } |