From patchwork Thu Apr 2 15:29:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Stach X-Patchwork-Id: 6149241 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id ECD82BF4A6 for ; Thu, 2 Apr 2015 15:31:22 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1E40B203C0 for ; Thu, 2 Apr 2015 15:31:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 1C0B4203B5 for ; Thu, 2 Apr 2015 15:31:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 683D16EA52; Thu, 2 Apr 2015 08:30:59 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [92.198.50.35]) by gabe.freedesktop.org (Postfix) with ESMTP id 41B6F6EA43 for ; Thu, 2 Apr 2015 08:30:56 -0700 (PDT) Received: from dude.hi.4.pengutronix.de ([10.1.0.7] helo=dude.pengutronix.de.) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Ydh55-0005OD-AF; Thu, 02 Apr 2015 17:30:55 +0200 From: Lucas Stach To: dri-devel@lists.freedesktop.org Subject: [PATCH RFC 006/111] staging: etnaviv: fix oops on unbind Date: Thu, 2 Apr 2015 17:29:08 +0200 Message-Id: <1427988653-754-7-git-send-email-l.stach@pengutronix.de> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1427988653-754-1-git-send-email-l.stach@pengutronix.de> References: <1427988653-754-1-git-send-email-l.stach@pengutronix.de> X-SA-Exim-Connect-IP: 10.1.0.7 X-SA-Exim-Mail-From: l.stach@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: dri-devel@lists.freedesktop.org Cc: Russell King , kernel@pengutronix.de 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Russell King The oops below was found when unbinding the etnaviv drm driver. This is caused by using drm_gem_object_unreference() in a region which is not protected by drm_dev->struct_mutex. Fix this by using drm_gem_object_unreference_unlocked() instead. Kernel BUG at c026cab8 [verbose debug info unavailable] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM Modules linked in: etnaviv(C-) ... task: d41dda80 ti: d63f2000 task.ti: d63f2000 PC is at drm_gem_object_free+0x34/0x38 LR is at etnaviv_gpu_unbind+0x7c/0xb0 [etnaviv] pc : [] lr : [] psr: 600d0013 sp : d63f3da0 ip : d63f3db0 fp : d63f3dac r10: 00020000 r9 : d63f2000 r8 : c000ece8 r7 : d4386c34 r6 : d4386c00 r5 : d42c4d80 r4 : d621ac10 r3 : d4386c00 r2 : 00000001 r1 : d608c410 r0 : d59da580 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 10c5387d Table: 14234019 DAC: 00000015 Process rmmod (pid: 1633, stack limit = 0xd63f2250) [] (drm_gem_object_free) from [] (etnaviv_gpu_unbind+0x7c/0xb0 [etnaviv]) [] (etnaviv_gpu_unbind [etnaviv]) from [] (component_unbind+0x38/0x70) [] (component_unbind) from [] (component_unbind_all+0x78/0xac) [] (component_unbind_all) from [] (etnaviv_unload+0x68/0x7c [etnaviv]) [] (etnaviv_unload [etnaviv]) from [] (drm_dev_unregister+0x2c/0xa0) [] (drm_put_dev) from [] (etnaviv_unbind+0x14/0x18 [etnaviv]) [] (etnaviv_unbind [etnaviv]) from [] (take_down_master+0x2c/0x4c) ... Signed-off-by: Russell King --- drivers/staging/etnaviv/etnaviv_gpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/etnaviv/etnaviv_gpu.c b/drivers/staging/etnaviv/etnaviv_gpu.c index e3b93c293dca..8e44493038cb 100644 --- a/drivers/staging/etnaviv/etnaviv_gpu.c +++ b/drivers/staging/etnaviv/etnaviv_gpu.c @@ -868,7 +868,7 @@ static void etnaviv_gpu_unbind(struct device *dev, struct device *master, WARN_ON(!list_empty(&gpu->active_list)); if (gpu->buffer) - drm_gem_object_unreference(gpu->buffer); + drm_gem_object_unreference_unlocked(gpu->buffer); if (gpu->mmu) etnaviv_iommu_destroy(gpu->mmu);