• Lukas Wunner's avatar
    drm/radeon: Fix oops upon driver load on PowerXpress laptops · e480eaba
    Lukas Wunner authored
    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]
      ...
      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
    
    Fixes: 7ffb0ce3 ("drm/radeon: Don't register Thunderbolt eGPU with vga_switcheroo")
    Reported-and-tested-by: default avatarNicolai Stange <nicstange@gmail.com>
    Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
    Link: http://patchwork.freedesktop.org/patch/msgid/cfb91ba052af06117137eec0637543a2626a7979.1495135190.git.lukas@wunner.de
    e480eaba
radeon_kms.c 27.9 KB