drm/panfrost: Fix a deadlock between the shrinker and madvise path
authorBoris Brezillon <boris.brezillon@collabora.com>
Sun, 1 Nov 2020 17:40:16 +0000 (18:40 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Nov 2020 11:39:10 +0000 (12:39 +0100)
commit084cb44ea6d66ccefcbe803fa9369b56c202032c
tree6ab3f939eb8371bf6be3a9fcc58077d2d8dd8455
parentd44362506d6d5f157d6233bb8d1e89684fcda198
drm/panfrost: Fix a deadlock between the shrinker and madvise path

commit 7d2d6d01293e6d9b42a6cb410be4158571f7fe9d upstream.

panfrost_ioctl_madvise() and panfrost_gem_purge() acquire the mappings
and shmem locks in different orders, thus leading to a potential
the mappings lock first.

Fixes: bdefca2d8dc0 ("drm/panfrost: Add the panfrost_gem_mapping concept")
Cc: <stable@vger.kernel.org>
Cc: Christian Hewitt <christianshewitt@gmail.com>
Reported-by: Christian Hewitt <christianshewitt@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20201101174016.839110-1-boris.brezillon@collabora.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/panfrost/panfrost_gem.c
drivers/gpu/drm/panfrost/panfrost_gem.h
drivers/gpu/drm/panfrost/panfrost_gem_shrinker.c