]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
drm/shmem-helper: Fix locking for drm_gem_shmem_get_pages_sgt()
authorAsahi Lina <lina@asahilina.net>
Sun, 5 Feb 2023 12:51:24 +0000 (21:51 +0900)
committerAndrea Righi <andrea.righi@canonical.com>
Tue, 14 Mar 2023 15:46:48 +0000 (16:46 +0100)
commit8d89d4bfa7948b519b12d1c5222facd96369a8a8
treec9f0c41407eb155c6184d6e0256e885394e25801
parentd275b58f663d1fb09ab61ced9f8f86504b2a7794
drm/shmem-helper: Fix locking for drm_gem_shmem_get_pages_sgt()

BugLink: https://bugs.launchpad.net/bugs/2011425
[ Upstream commit ddddedaa0db99481c5e5abe628ad54f65e8765bc ]

Other functions touching shmem->sgt take the pages lock, so do that here
too. drm_gem_shmem_get_pages() & co take the same lock, so move to the
_locked() variants to avoid recursive locking.

Discovered while auditing locking to write the Rust abstractions.

Fixes: 2194a63a818d ("drm: Add library for shmem backed GEM objects")
Fixes: 4fa3d66f132b ("drm/shmem: Do dma_unmap_sg before purging pages")
Signed-off-by: Asahi Lina <lina@asahilina.net>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230205125124.2260-1-lina@asahilina.net
(cherry picked from commit aa8c85affe3facd3842c8912186623415931cc72)
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
drivers/gpu/drm/drm_gem_shmem_helper.c