From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755348AbdKJBFv (ORCPT ); Thu, 9 Nov 2017 20:05:51 -0500 Received: from mail-wr0-f193.google.com ([209.85.128.193]:47393 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755387AbdKJBFr (ORCPT ); Thu, 9 Nov 2017 20:05:47 -0500 X-Google-Smtp-Source: ABhQp+RQRmThpyxecPxxWsDz1P30DK1jzJC4lNzbyJuZ13fPwYW8ERlyIpcpxK1v+O5L1E+GXR3ZuA== From: Stefan Schake To: dri-devel@lists.freedesktop.org Cc: linux-rpi-kernel@lists.infradead.org, Stefan Schake , Eric Anholt , David Airlie , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] drm/vc4: Account for interrupts in flight Date: Fri, 10 Nov 2017 02:05:06 +0100 Message-Id: <1510275907-993-2-git-send-email-stschake@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1510275907-993-1-git-send-email-stschake@gmail.com> References: <1510275907-993-1-git-send-email-stschake@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Synchronously disable the IRQ to make the following cancel_work_sync invocation effective. An interrupt in flight could enqueue further overflow mem work. As we free the binner BO immediately following vc4_irq_uninstall this caused a NULL pointer dereference in the work callback vc4_overflow_mem_work. Link: https://github.com/anholt/linux/issues/114 Signed-off-by: Stefan Schake Fixes: d5b1a78a772f ("drm/vc4: Add support for drawing 3D frames.") --- drivers/gpu/drm/vc4/vc4_irq.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c index 7d7af3a..61b2e53 100644 --- a/drivers/gpu/drm/vc4/vc4_irq.c +++ b/drivers/gpu/drm/vc4/vc4_irq.c @@ -208,6 +208,9 @@ { struct vc4_dev *vc4 = to_vc4_dev(dev); + /* Undo the effects of a previous vc4_irq_uninstall. */ + enable_irq(dev->irq); + /* Enable both the render done and out of memory interrupts. */ V3D_WRITE(V3D_INTENA, V3D_DRIVER_IRQS); @@ -225,6 +228,9 @@ /* Clear any pending interrupts we might have left. */ V3D_WRITE(V3D_INTCTL, V3D_DRIVER_IRQS); + /* Finish any interrupt handler still in flight. */ + disable_irq(dev->irq); + cancel_work_sync(&vc4->overflow_mem_work); } -- 1.9.1