]> git.baikalelectronics.ru Git - kernel.git/commit
drm/panfrost: Don't dereference bogus MMU pointers
authorRobin Murphy <robin.murphy@arm.com>
Mon, 28 Oct 2019 20:08:25 +0000 (20:08 +0000)
committerRob Herring <robh@kernel.org>
Tue, 29 Oct 2019 18:18:17 +0000 (13:18 -0500)
commitbffcef43339e08f51acbb0a8ec857379f9b03792
tree96605060d4e9da19aaa30a854b001277da6401b2
parent032a9d0b9157ec448564a2e939b56c6e47fd4ab1
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: a7aede2d3cda ("drm/panfrost: Prevent race when handling page fault")
Signed-off-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Rob Herring <robh@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/9a0b09e6b5851f0d4428b72dd6b8b4c0d0ef4206.1572293305.git.robin.murphy@arm.com
drivers/gpu/drm/panfrost/panfrost_mmu.c