drm/ttm: fix locking in vmap/vunmap TTM GEM helpers
authorChristian König <christian.koenig@amd.com>
Fri, 15 Jul 2022 07:57:22 +0000 (09:57 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 29 Jul 2022 15:25:05 +0000 (17:25 +0200)
commit60e536b0a564eabaeae5fb3ac2f806df95134e78
tree37a5ef43ce11425914331f4496f3ace15ba1ea54
parent0e66932a9dc9ba47e60405b392e3782a332bc44e
drm/ttm: fix locking in vmap/vunmap TTM GEM helpers

commit dbd0da2453c694f2f74651834d90fb280b57f151 upstream.

I've stumbled over this while reviewing patches for DMA-buf and it looks
like we completely messed the locking up here.

In general most TTM function should only be called while holding the
appropriate BO resv lock. Without this we could break the internal
buffer object state here.

Only compile tested!

Signed-off-by: Christian König <christian.koenig@amd.com>
Fixes: 43676605f890 ("drm/ttm: Add vmap/vunmap to TTM and TTM GEM helpers")
Cc: stable@vger.kernel.org
Reviewed-by: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220715111533.467012-1-christian.koenig@amd.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/drm_gem_ttm_helper.c