lkundrak / rpms / kernel

Forked from rpms/kernel 4 years ago
Clone
fe6b94d
From 253696ccd613fbdaa5aba1de44c461a058e0a114 Mon Sep 17 00:00:00 2001
fe6b94d
From: Stefan Schake <stschake@gmail.com>
fe6b94d
Date: Fri, 10 Nov 2017 02:05:06 +0100
fe6b94d
Subject: drm/vc4: Account for interrupts in flight
fe6b94d
fe6b94d
Synchronously disable the IRQ to make the following cancel_work_sync
fe6b94d
invocation effective.
fe6b94d
fe6b94d
An interrupt in flight could enqueue further overflow mem work. As we
fe6b94d
free the binner BO immediately following vc4_irq_uninstall this caused
fe6b94d
a NULL pointer dereference in the work callback vc4_overflow_mem_work.
fe6b94d
fe6b94d
Link: https://github.com/anholt/linux/issues/114
fe6b94d
Signed-off-by: Stefan Schake <stschake@gmail.com>
fe6b94d
Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.")
fe6b94d
Signed-off-by: Eric Anholt <eric@anholt.net>
fe6b94d
Reviewed-by: Eric Anholt <eric@anholt.net>
fe6b94d
Link: https://patchwork.freedesktop.org/patch/msgid/1510275907-993-2-git-send-email-stschake@gmail.com
fe6b94d
fe6b94d
diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c
fe6b94d
index 7d7af3a..61b2e53 100644
fe6b94d
--- a/drivers/gpu/drm/vc4/vc4_irq.c
fe6b94d
+++ b/drivers/gpu/drm/vc4/vc4_irq.c
fe6b94d
@@ -208,6 +208,9 @@ vc4_irq_postinstall(struct drm_device *dev)
fe6b94d
 {
fe6b94d
 	struct vc4_dev *vc4 = to_vc4_dev(dev);
fe6b94d
 
fe6b94d
+	/* Undo the effects of a previous vc4_irq_uninstall. */
fe6b94d
+	enable_irq(dev->irq);
fe6b94d
+
fe6b94d
 	/* Enable both the render done and out of memory interrupts. */
fe6b94d
 	V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS);
fe6b94d
 
fe6b94d
@@ -225,6 +228,9 @@ vc4_irq_uninstall(struct drm_device *dev)
fe6b94d
 	/* Clear any pending interrupts we might have left. */
fe6b94d
 	V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS);
fe6b94d
 
fe6b94d
+	/* Finish any interrupt handler still in flight. */
fe6b94d
+	disable_irq(dev->irq);
fe6b94d
+
fe6b94d
 	cancel_work_sync(&vc4->overflow_mem_work);
fe6b94d
 }
fe6b94d
 
fe6b94d
-- 
fe6b94d
cgit v0.10.2
fe6b94d