diff options
authorRobin Murphy <>2019-10-28 20:08:25 +0000
committerRob Herring <>2019-10-29 13:18:17 -0500
commitf70744c68779c8a72a0c82294e3233b994af656d (patch)
parent6f39188c9d5f81af7a3bc687636b7abc9629ee27 (diff)
drm/panfrost: Don't dereference bogus MMU pointers
It seems that killing an application while faults are occurring (particularly with a GPU in FPGA at a whopping 40MHz) can lead to handling a lingering page fault after all the address space contexts have already been freed. In this situation, the LRU list is empty so addr_to_drm_mm_node() ends up dereferencing the list head as if it were a struct panfrost_mmu entry; this leaves "mmu->as" actually pointing at the pfdev->alloc_mask bitmap, which is also empty, and given that the fault has a high likelihood of being in AS0, hilarity ensues. Sadly, the cleanest solution seems to involve another goto. Oh well, at least it's robust... Fixes: 65e51e30d862 ("drm/panfrost: Prevent race when handling page fault") Signed-off-by: Robin Murphy <> Signed-off-by: Rob Herring <> Link:
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c
index 87e7963b8adf..a3ed64a1f15e 100644
--- a/drivers/gpu/drm/panfrost/panfrost_mmu.c
+++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c
@@ -406,11 +406,11 @@ addr_to_drm_mm_node(struct panfrost_device *pfdev, int as, u64 addr)
list_for_each_entry(mmu, &pfdev->as_lru_list, list) {
if (as == mmu->as)
- break;
+ goto found_mmu;
- if (as != mmu->as)
- goto out;
+ goto out;
priv = container_of(mmu, struct panfrost_file_priv, mmu);