summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLucas Stach <l.stach@pengutronix.de>2022-03-23 19:08:22 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-06-14 19:11:47 +0300
commit19323b3671a85788569d15685c8f83a05ec48cbb (patch)
tree301ffe998b09e2a07aa5a14ba3f3cef74a80003a /drivers
parentc12984cdb077b9042d2dc20ca18cb16a87bcc774 (diff)
downloadlinux-19323b3671a85788569d15685c8f83a05ec48cbb.tar.xz
drm/etnaviv: check for reaped mapping in etnaviv_iommu_unmap_gem
commit e168c25526cd0368af098095c2ded4a008007e1b upstream. When the mapping is already reaped the unmap must be a no-op, as we would otherwise try to remove the mapping twice, corrupting the involved data structures. Cc: stable@vger.kernel.org # 5.4 Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Tested-by: Guido Günther <agx@sigxcpu.org> Acked-by: Guido Günther <agx@sigxcpu.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/etnaviv/etnaviv_mmu.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
index 707f5c1a5874..790cbb20aaeb 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_mmu.c
@@ -289,6 +289,12 @@ void etnaviv_iommu_unmap_gem(struct etnaviv_iommu_context *context,
mutex_lock(&context->lock);
+ /* Bail if the mapping has been reaped by another thread */
+ if (!mapping->context) {
+ mutex_unlock(&context->lock);
+ return;
+ }
+
/* If the vram node is on the mm, unmap and remove the node */
if (mapping->vram_node.mm == &context->mm)
etnaviv_iommu_remove_mapping(context, mapping);