From patchwork Thu May 18 19:33:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lukas Wunner X-Patchwork-Id: 9735105 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 DEF6D601BC for ; Thu, 18 May 2017 19:33:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D9B52288D0 for ; Thu, 18 May 2017 19:33:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CDFB9288F1; Thu, 18 May 2017 19:33:55 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 CC7B4288D0 for ; Thu, 18 May 2017 19:33:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 83AA56E169; Thu, 18 May 2017 19:33:50 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.hostsharing.net (mailout3.hostsharing.net [176.9.242.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2F0A06E12B; Thu, 18 May 2017 19:33:49 +0000 (UTC) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout3.hostsharing.net (Postfix) with ESMTPS id 6164A104F2F15; Thu, 18 May 2017 21:33:54 +0200 (CEST) Received: from localhost (5-38-90-81.adsl.cmo.de [81.90.38.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA (128/128 bits)) (No client certificate requested) by h08.hostsharing.net (Postfix) with ESMTPSA id D88646120290; Thu, 18 May 2017 21:33:44 +0200 (CEST) X-Mailbox-Line: From cfb91ba052af06117137eec0637543a2626a7979 Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: <20170518080501.GA31002@wunner.de> References: <20170518080501.GA31002@wunner.de> From: Lukas Wunner Date: Thu, 18 May 2017 21:33:44 +0200 Subject: [PATCH] drm/radeon: Fix oops upon driver load on PowerXpress laptops To: Alex Deucher , Nicolai Stange Cc: dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, Christian Koenig 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 Nicolai Stange reports the following oops which is caused by dereferencing rdev->pdev before it's subsequently set by radeon_device_init(). Fix it. BUG: unable to handle kernel NULL pointer dereference at 00000000000007cb IP: radeon_driver_load_kms+0xeb/0x230 [radeon] PGD 0 P4D 0 Oops: 0000 [#1] SMP Modules linked in: amdkfd amd_iommu_v2 i915(+) radeon(+) i2c_algo_bit drm_kms_helper ttm e1000e drm sdhci_pci sdhci_acpi ptp sdhci crc32c_intel serio_raw mmc_core pps_core video i2c_hid hid_plantronics CPU: 4 PID: 389 Comm: systemd-udevd Not tainted 4.12.0-rc1-next-20170515+ #1 Hardware name: Dell Inc. Latitude E6540/0725FP, BIOS A10 06/26/2014 task: ffff97d62c8f0000 task.stack: ffffb96f01478000 RIP: 0010:radeon_driver_load_kms+0xeb/0x230 [radeon] RSP: 0018:ffffb96f0147b9d0 EFLAGS: 00010246 RAX: 0000000000000000 RBX: ffff97d620085000 RCX: 0000000000610037 RDX: 0000000000000000 RSI: 000000000000002b RDI: 0000000000000000 RBP: ffffb96f0147b9e8 R08: 0000000000000002 R09: ffffb96f0147b924 R10: 0000000000000000 R11: ffff97d62edd2ec0 R12: ffff97d628d5c000 R13: 0000000000610037 R14: ffffffffc0698280 R15: 0000000000000000 FS: 00007f496363d8c0(0000) GS:ffff97d62eb00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000007cb CR3: 000000022c14c000 CR4: 00000000001406e0 Call Trace: drm_dev_register+0x146/0x1d0 [drm] drm_get_pci_dev+0x9a/0x180 [drm] radeon_pci_probe+0xb8/0xe0 [radeon] local_pci_probe+0x45/0xa0 pci_device_probe+0x14f/0x1a0 driver_probe_device+0x29c/0x450 __driver_attach+0xdf/0xf0 ? driver_probe_device+0x450/0x450 bus_for_each_dev+0x6c/0xc0 driver_attach+0x1e/0x20 bus_add_driver+0x170/0x270 driver_register+0x60/0xe0 ? 0xffffffffc0508000 __pci_register_driver+0x4c/0x50 drm_pci_init+0xeb/0x100 [drm] ? vga_switcheroo_register_handler+0x6a/0x90 ? 0xffffffffc0508000 radeon_init+0x98/0xb6 [radeon] do_one_initcall+0x52/0x1a0 ? __vunmap+0x81/0xb0 ? kmem_cache_alloc_trace+0x159/0x1b0 ? do_init_module+0x27/0x1f8 do_init_module+0x5f/0x1f8 load_module+0x27ce/0x2be0 SYSC_finit_module+0xdf/0x110 ? SYSC_finit_module+0xdf/0x110 SyS_finit_module+0xe/0x10 do_syscall_64+0x67/0x150 entry_SYSCALL64_slow_path+0x25/0x25 RIP: 0033:0x7f4962295679 RSP: 002b:00007ffdd8c4f878 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000055c014ed8200 RCX: 00007f4962295679 RDX: 0000000000000000 RSI: 00007f4962dd19c5 RDI: 0000000000000010 RBP: 00007f4962dd19c5 R08: 0000000000000000 R09: 00007ffdd8c4f990 R10: 0000000000000010 R11: 0000000000000246 R12: 0000000000000000 R13: 000055c014ed81a0 R14: 0000000000020000 R15: 000055c0149d1fca Code: 5d 5d c3 8b 05 a7 05 14 00 49 81 cd 00 00 08 00 85 c0 74 a3 e8 e7 c0 0e 00 84 c0 74 9a 41 f7 c5 00 00 02 00 75 91 49 8b 44 24 10 <0f> b6 90 cb 07 00 00 f6 c2 20 74 1e e9 7b ff ff ff 48 8b 40 38 RIP: radeon_driver_load_kms+0xeb/0x230 [radeon] RSP: ffffb96f0147b9d0 CR2: 00000000000007cb ---[ end trace 89cc4ba7e569c65c ]--- Reported-by: Nicolai Stange Fixes: 7ffb0ce31cf9 ("drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo") Signed-off-by: Lukas Wunner Tested-by: Nicolai Stange --- Awaiting a Tested-by: from Nicolai, but it's clear this is a bug and needs to be fixed, so sending out with a proper commit message now. The bug was only introduced to radeon, not amdgpu. @Alex Deucher: I could push this to drm-misc-fixes but then it wouldn't land before -rc3 because Sean Paul has already sent out the -rc2 pull. I notice you haven't sent out a pull for -rc2 yet, so maybe you want to take it yourself? Whichever you prefer. Thanks & sorry for the breakage! drivers/gpu/drm/radeon/radeon_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_kms.c b/drivers/gpu/drm/radeon/radeon_kms.c index 6a68d440bc44..d0ad03674250 100644 --- a/drivers/gpu/drm/radeon/radeon_kms.c +++ b/drivers/gpu/drm/radeon/radeon_kms.c @@ -116,7 +116,7 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags) if ((radeon_runtime_pm != 0) && radeon_has_atpx() && ((flags & RADEON_IS_IGP) == 0) && - !pci_is_thunderbolt_attached(rdev->pdev)) + !pci_is_thunderbolt_attached(dev->pdev)) flags |= RADEON_IS_PX; /* radeon_device_init should report only fatal error