iris: fix BO destruction in error path
authorLionel Landwerlin <lionel.g.landwerlin@intel.com>
Sat, 2 May 2020 19:43:22 +0000 (22:43 +0300)
committerMarge Bot <eric+marge@anholt.net>
Thu, 4 Jun 2020 07:31:38 +0000 (07:31 +0000)
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Cc: <mesa-stable@lists.freedesktop.org>
Tested-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4861>

src/gallium/drivers/iris/iris_bufmgr.c

index cad15bea08a5dc9214dc1bd085aa4910ca948548..f2cd53b4495a5b49d8a77bdf19b80036493bd1e7 100644 (file)
@@ -588,6 +588,7 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
                        void *ptr, size_t size,
                        enum iris_memory_zone memzone)
 {
+   struct drm_gem_close close = { 0, };
    struct iris_bo *bo;
 
    bo = bo_calloc();
@@ -633,7 +634,8 @@ iris_bo_create_userptr(struct iris_bufmgr *bufmgr, const char *name,
    return bo;
 
 err_close:
-   gen_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &bo->gem_handle);
+   close.handle = bo->gem_handle;
+   gen_ioctl(bufmgr->fd, DRM_IOCTL_GEM_CLOSE, &close);
 err_free:
    free(bo);
    return NULL;