From patchwork Fri Nov 10 01:05:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Schake X-Patchwork-Id: 10052203 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2B886032D for ; Fri, 10 Nov 2017 01:05:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B63302B227 for ; Fri, 10 Nov 2017 01:05:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AAEC02B225; Fri, 10 Nov 2017 01:05:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 733672B225 for ; Fri, 10 Nov 2017 01:05:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C5D376E9C8; Fri, 10 Nov 2017 01:05:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id AA6C06E9C8 for ; Fri, 10 Nov 2017 01:05:47 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id q66so7208628wrb.13 for ; Thu, 09 Nov 2017 17:05:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=rtUIwpSU/0E3eqPeemWM6MuH6JWOlWW3PTUMi1XoZO8=; b=qiW2zt5AVp/bkevejCRHLSQPAyeTdAStjET0mqEk6saUN3PYtAWYwfwhsb3vDoglX0 8rbIjlnxKcbdai2BzRmO8rCPNY6Cw/zVPfsrEko1fXclQqhfIHuD2Cs68Eyiqo5JdQY+ 2c+6vKAY5kpP9uN3/a/5mGtPg3+BewQ8qOVXFCSGQJSG1xmPgX6Qq/dQZ7ch/ipAS58q LfXUP3zMknz5fEU8amNIXfSG2yBfeFsw+u4goN64vjxe8zeXh7R63EosT56lY7myvP9Y AbN2C8PuIJlR5GNUFYcD0+gdteBBkslNRWlLgGTn5Q4IuqS6DJqwPRF9rpkLAoRonJA6 duwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=rtUIwpSU/0E3eqPeemWM6MuH6JWOlWW3PTUMi1XoZO8=; b=I6NmIuS7hQm1UxvBxJZHKetzPXAsGxgUXPg0fxsXbcqkWIa4UVNTlFddOp/AkJMDeX oHqAwCNnwSFZxEbTquNk5QV7TotGf0iGtryXIKtuiY8qMlMAtog40k0B6/0w930SV6ao 8gmC4sm/zt3Imt2b8khJSBGn1PP1/qkzSHfYK5gSHI1l3OTRcHKHYKVtuke75Iq8KeHc 6xPd9Zgw9dA0vermw4BKTf8uT6dKZ9ObR2Xw8FPqgeSy19gnXbnAcQ2jaBCjq6hkNOic msj7hEq3/iLTplkmA+rMSs/Usme0crl9I5OBXcq2j5N1XuwlOE2++E6IUSLsxZKrG56M Yfug== X-Gm-Message-State: AJaThX4BnMMh5N0xUNjKwxqSti889b0uEUJc00e7UGG0METwMf9tP24a eohGvQgS8wzL+54qbv8/xlfBuxztWHk= X-Google-Smtp-Source: ABhQp+RQRmThpyxecPxxWsDz1P30DK1jzJC4lNzbyJuZ13fPwYW8ERlyIpcpxK1v+O5L1E+GXR3ZuA== X-Received: by 10.223.186.202 with SMTP id w10mr2046882wrg.132.1510275945975; Thu, 09 Nov 2017 17:05:45 -0800 (PST) Received: from DESKTOP-FFGKHJ4.localdomain (x5ce37315.dyn.telefonica.de. [92.227.115.21]) by smtp.gmail.com with ESMTPSA id p128sm278720wmb.1.2017.11.09.17.05.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Nov 2017 17:05:45 -0800 (PST) From: Stefan Schake To: dri-devel@lists.freedesktop.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> Cc: David Airlie , linux-rpi-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Schake X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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); }