Merge branch 'etnaviv/fixes' of https://git.pengutronix.de/git/lst/linux into drm...
authorDave Airlie <airlied@redhat.com>
Thu, 30 May 2019 00:48:09 +0000 (10:48 +1000)
committerDave Airlie <airlied@redhat.com>
Thu, 30 May 2019 00:50:41 +0000 (10:50 +1000)
etnaviv core dump locking fix

Signed-off-by: Dave Airlie <airlied@redhat.com>
From: Lucas Stach <l.stach@pengutronix.de>
Link: https://patchwork.freedesktop.org/patch/msgid/1558966666.4039.4.camel@pengutronix.de
drivers/gpu/drm/etnaviv/etnaviv_dump.c

index 33854c94cb858f1cf62209e5f1c5e8d5de69e3e1..515515ef24f9adbad310199ca09c4478c1237d71 100644 (file)
@@ -125,6 +125,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
                return;
        etnaviv_dump_core = false;
 
+       mutex_lock(&gpu->mmu->lock);
+
        mmu_size = etnaviv_iommu_dump_size(gpu->mmu);
 
        /* We always dump registers, mmu, ring and end marker */
@@ -167,6 +169,7 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
        iter.start = __vmalloc(file_size, GFP_KERNEL | __GFP_NOWARN | __GFP_NORETRY,
                               PAGE_KERNEL);
        if (!iter.start) {
+               mutex_unlock(&gpu->mmu->lock);
                dev_warn(gpu->dev, "failed to allocate devcoredump file\n");
                return;
        }
@@ -234,6 +237,8 @@ void etnaviv_core_dump(struct etnaviv_gpu *gpu)
                                         obj->base.size);
        }
 
+       mutex_unlock(&gpu->mmu->lock);
+
        etnaviv_core_dump_header(&iter, ETDUMP_BUF_END, iter.data);
 
        dev_coredumpv(gpu->dev, iter.start, iter.data - iter.start, GFP_KERNEL);