drm/cma-helper: Fix drm_gem_cma_free_object()
authorNoralf Trønnes <noralf@tronnes.org>
Fri, 26 Apr 2019 12:47:53 +0000 (14:47 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Jun 2019 07:16:18 +0000 (09:16 +0200)
commit198c6c24db7c754dbb4e75a72c8ed9cb7aabfb69
tree246f11782f03dd9030765083ba27b6ae1205bc0c
parent89fd996087277e43cf3aa4c413a74c8bf42e0918
drm/cma-helper: Fix drm_gem_cma_free_object()

commit 23e35c0eb81a23d40c079a7eb187fc321fa1deb7 upstream.

The logic for freeing an imported buffer with a virtual address is
broken. It will free the buffer instead of unmapping the dma buf.
Fix by reversing the if ladder and first check if the buffer is imported.

Fixes: b9068cde51ee ("drm/cma-helper: Add DRM_GEM_CMA_VMAP_DRIVER_OPS")
Cc: stable@vger.kernel.org
Reported-by: "Li, Tingqian" <tingqian.li@intel.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Reviewed-by: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20190426124753.53722-1-noralf@tronnes.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/drm_gem_cma_helper.c