]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/shmem-helper: Add missing vunmap on error
authorDmitry Osipenko <dmitry.osipenko@collabora.com>
Thu, 30 Jun 2022 20:00:57 +0000 (23:00 +0300)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 9 Aug 2022 16:15:42 +0000 (18:15 +0200)
The vmapping of dma-buf may succeed, but DRM SHMEM rejects the IOMEM
mapping, and thus, drm_gem_shmem_vmap_locked() should unvmap the IOMEM
before erroring out.

Cc: stable@vger.kernel.org
Fixes: 67c70da25fa3 ("drm/gem: Use struct dma_buf_map in GEM vmap ops and convert GEM backends")
Signed-off-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20220630200058.1883506-2-dmitry.osipenko@collabora.com
drivers/gpu/drm/drm_gem_shmem_helper.c

index 8ad0e02991ca00b9b8a17119fdcdcccc37a2c97e..904fc893c905bf7986f1d7d9b59d2ec0ec24577e 100644 (file)
@@ -302,6 +302,7 @@ static int drm_gem_shmem_vmap_locked(struct drm_gem_shmem_object *shmem,
                ret = dma_buf_vmap(obj->import_attach->dmabuf, map);
                if (!ret) {
                        if (WARN_ON(map->is_iomem)) {
+                               dma_buf_vunmap(obj->import_attach->dmabuf, map);
                                ret = -EIO;
                                goto err_put_pages;
                        }