Skip to content

Commit

Permalink
drm/amdkcl: init the ddev->pdev for legacy os
Browse files Browse the repository at this point in the history
This is caused by "Upcast struct drm_device.dev to struct pci_device;
replace pdev"
v5.11-rc2-514-g36b73b051c41

Otherwise, NULL pointer dereference will be reported for drm_pci_set_busid:

[   55.850413] BUG: kernel NULL pointer dereference, address:
0000000000000038
[   55.850456] #PF: supervisor read access in kernel mode
[   55.850482] #PF: error_code(0x0000) - not-present page
[   55.850507] PGD 0 P4D 0
[   55.850524] Oops: 0000 [#1] SMP NOPTI
[   55.850545] CPU: 7 PID: 1687 Comm: Xorg Tainted: G           OE
5.8.0-45-generic #51~20.04.1-Ubuntu
[   55.850587] Hardware name: System manufacturer System Product
Name/PRIME Z390-A, BIOS 1201 07/29/2019
[   55.850655] RIP: 0010:drm_pci_set_busid+0x16/0x80 [drm]
[   55.850681] Code: 8b 85 80 01 00 00 eb 86 c3 66 2e 0f 1f 84 00 00 00
00 00 90 0f 1f 44 00 00 55 31 d2 48 89 e5 53 48 8b 87 88 01 00 00 48 89
f3 <44> 8b 40 38 48 8b 40 10 45 89 c1 41 c1 e8 03 0f b6 88 e0 00 00 00
[   55.850762] RSP: 0018:ffffb768c0fabd20 EFLAGS: 00010246
[   55.850788] RAX: 0000000000000000 RBX: ffffa0745070a840 RCX:
0000000000000002
[   55.850820] RDX: 0000000000000000 RSI: ffffa0745070a840 RDI:
ffffa0742dbe0010
[   55.850853] RBP: ffffb768c0fabd28 R08: 0000000000000000 R09:
ffffffffc046e5d9
[   55.850886] R10: 0000000000000000 R11: 0000000000000000 R12:
ffffa0742dbe0010
[   55.850918] R13: ffffa0742d2abe00 R14: ffffa0742dbe00b8 R15:
ffffa0745070a840
[   55.850952] FS:  00007f6673a15a40(0000) GS:ffffa0745ddc0000(0000)
knlGS:0000000000000000
[   55.850989] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[   55.851016] CR2: 0000000000000038 CR3: 00000004506da006 CR4:
00000000003606e0
[   55.851049] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[   55.851082] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[   55.851114] Call Trace:
[   55.851149]  drm_setversion+0x14e/0x190 [drm]
[   55.851188]  ? drm_ioctl_permit+0x80/0x80 [drm]
[   55.851227]  drm_ioctl_kernel+0xae/0xf0 [drm]
[   55.851266]  drm_ioctl+0x234/0x3d0 [drm]
[   55.851302]  ? drm_ioctl_permit+0x80/0x80 [drm]
[   55.851449]  amdgpu_drm_ioctl+0x4e/0x80 [amdgpu]
[   55.851478]  ksys_ioctl+0x9d/0xd0
[   55.851496]  __x64_sys_ioctl+0x1a/0x20
[   55.851519]  do_syscall_64+0x49/0xc0
[   55.851539]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[   55.851565] RIP: 0033:0x7f6673d7550b

Signed-off-by: Shiwu Zhang <shiwu.zhang@amd.com>
  • Loading branch information
Shiwu Zhang committed Mar 22, 2021
1 parent 4d762cd commit 24ebde1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@ static int amdgpu_pci_probe(struct pci_dev *pdev,
goto err_free;
#endif

ddev->pdev = pdev;
pci_set_drvdata(pdev, ddev);

ret = amdgpu_driver_load_kms(adev, ent->driver_data);
Expand Down

0 comments on commit 24ebde1

Please sign in to comment.