Qu Huang
820daf9ffe
drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
[ Upstream commit 5104fdf50d ]
In certain types of chips, such as VEGA20, reading the amdgpu_regs_smc file could result in an abnormal null pointer access when the smc_rreg pointer is NULL. Below are the steps to reproduce this issue and the corresponding exception log:
1. Navigate to the directory: /sys/kernel/debug/dri/0
2. Execute command: cat amdgpu_regs_smc
3. Exception Log::
[4005007.702554] BUG: kernel NULL pointer dereference, address: 0000000000000000
[4005007.702562] #PF: supervisor instruction fetch in kernel mode
[4005007.702567] #PF: error_code(0x0010) - not-present page
[4005007.702570] PGD 0 P4D 0
[4005007.702576] Oops: 0010 [#1] SMP NOPTI
[4005007.702581] CPU: 4 PID: 62563 Comm: cat Tainted: G OE 5.15.0-43-generic #46-Ubunt u
[4005007.702590] RIP: 0010:0x0
[4005007.702598] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[4005007.702600] RSP: 0018:ffffa82b46d27da0 EFLAGS: 00010206
[4005007.702605] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffa82b46d27e68
[4005007.702609] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff9940656e0000
[4005007.702612] RBP: ffffa82b46d27dd8 R08: 0000000000000000 R09: ffff994060c07980
[4005007.702615] R10: 0000000000020000 R11: 0000000000000000 R12: 00007f5e06753000
[4005007.702618] R13: ffff9940656e0000 R14: ffffa82b46d27e68 R15: 00007f5e06753000
[4005007.702622] FS: 00007f5e0755b740(0000) GS:ffff99479d300000(0000) knlGS:0000000000000000
[4005007.702626] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[4005007.702629] CR2: ffffffffffffffd6 CR3: 00000003253fc000 CR4: 00000000003506e0
[4005007.702633] Call Trace:
[4005007.702636] <TASK>
[4005007.702640] amdgpu_debugfs_regs_smc_read+0xb0/0x120 [amdgpu]
[4005007.703002] full_proxy_read+0x5c/0x80
[4005007.703011] vfs_read+0x9f/0x1a0
[4005007.703019] ksys_read+0x67/0xe0
[4005007.703023] __x64_sys_read+0x19/0x20
[4005007.703028] do_syscall_64+0x5c/0xc0
[4005007.703034] ? do_user_addr_fault+0x1e3/0x670
[4005007.703040] ? exit_to_user_mode_prepare+0x37/0xb0
[4005007.703047] ? irqentry_exit_to_user_mode+0x9/0x20
[4005007.703052] ? irqentry_exit+0x19/0x30
[4005007.703057] ? exc_page_fault+0x89/0x160
[4005007.703062] ? asm_exc_page_fault+0x8/0x30
[4005007.703068] entry_SYSCALL_64_after_hwframe+0x44/0xae
[4005007.703075] RIP: 0033:0x7f5e07672992
[4005007.703079] Code: c0 e9 b2 fe ff ff 50 48 8d 3d fa b2 0c 00 e8 c5 1d 02 00 0f 1f 44 00 00 f3 0f 1e fa 64 8b 04 25 18 00 00 00 85 c0 75 10 0f 05 <48> 3d 00 f0 ff ff 77 56 c3 0f 1f 44 00 00 48 83 e c 28 48 89 54 24
[4005007.703083] RSP: 002b:00007ffe03097898 EFLAGS: 00000246 ORIG_RAX: 0000000000000000
[4005007.703088] RAX: ffffffffffffffda RBX: 0000000000020000 RCX: 00007f5e07672992
[4005007.703091] RDX: 0000000000020000 RSI: 00007f5e06753000 RDI: 0000000000000003
[4005007.703094] RBP: 00007f5e06753000 R08: 00007f5e06752010 R09: 00007f5e06752010
[4005007.703096] R10: 0000000000000022 R11: 0000000000000246 R12: 0000000000022000
[4005007.703099] R13: 0000000000000003 R14: 0000000000020000 R15: 0000000000020000
[4005007.703105] </TASK>
[4005007.703107] Modules linked in: nf_tables libcrc32c nfnetlink algif_hash af_alg binfmt_misc nls_ iso8859_1 ipmi_ssif ast intel_rapl_msr intel_rapl_common drm_vram_helper drm_ttm_helper amd64_edac t tm edac_mce_amd kvm_amd ccp mac_hid k10temp kvm acpi_ipmi ipmi_si rapl sch_fq_codel ipmi_devintf ipm i_msghandler msr parport_pc ppdev lp parport mtd pstore_blk efi_pstore ramoops pstore_zone reed_solo mon ip_tables x_tables autofs4 ib_uverbs ib_core amdgpu(OE) amddrm_ttm_helper(OE) amdttm(OE) iommu_v 2 amd_sched(OE) amdkcl(OE) drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops cec rc_core drm igb ahci xhci_pci libahci i2c_piix4 i2c_algo_bit xhci_pci_renesas dca
[4005007.703184] CR2: 0000000000000000
[4005007.703188] ---[ end trace ac65a538d240da39 ]---
[4005007.800865] RIP: 0010:0x0
[4005007.800871] Code: Unable to access opcode bytes at RIP 0xffffffffffffffd6.
[4005007.800874] RSP: 0018:ffffa82b46d27da0 EFLAGS: 00010206
[4005007.800878] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffa82b46d27e68
[4005007.800881] RDX: 0000000000000001 RSI: 0000000000000000 RDI: ffff9940656e0000
[4005007.800883] RBP: ffffa82b46d27dd8 R08: 0000000000000000 R09: ffff994060c07980
[4005007.800886] R10: 0000000000020000 R11: 0000000000000000 R12: 00007f5e06753000
[4005007.800888] R13: ffff9940656e0000 R14: ffffa82b46d27e68 R15: 00007f5e06753000
[4005007.800891] FS: 00007f5e0755b740(0000) GS:ffff99479d300000(0000) knlGS:0000000000000000
[4005007.800895] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[4005007.800898] CR2: ffffffffffffffd6 CR3: 00000003253fc000 CR4: 00000000003506e0
Signed-off-by: Qu Huang <qu.huang@linux.dev>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-11-28 17:14:46 +00:00
..
2023-06-09 12:34:59 -04:00
2023-06-09 12:39:36 -04:00
2023-06-09 12:37:50 -04:00
2023-06-09 10:47:53 -04:00
2023-06-09 09:42:43 -04:00
2023-06-09 09:42:43 -04:00
2023-06-09 12:36:46 -04:00
2023-06-09 12:36:46 -04:00
2023-06-09 12:36:46 -04:00
2023-06-09 12:36:46 -04:00
2023-06-09 12:36:46 -04:00
2023-06-09 12:39:36 -04:00
2023-07-18 14:42:54 -04:00
2023-10-06 13:16:11 +02:00
2023-06-09 12:36:43 -04:00
2023-06-23 15:35:26 -04:00
2023-06-23 15:35:26 -04:00
2023-06-23 15:35:16 -04:00
2023-06-09 09:29:51 -04:00
2022-11-21 16:40:30 -05:00
2022-12-06 12:54:14 +01:00
2023-01-10 14:32:58 -05:00
2023-06-09 09:25:43 -04:00
2023-09-23 11:14:38 +02:00
2022-12-06 12:54:14 +01:00
2023-06-09 12:47:26 -04:00
2023-06-09 12:47:26 -04:00
2023-11-08 14:09:01 +01:00
2023-06-15 11:37:55 -04:00
2023-11-28 17:14:46 +00:00
2023-11-28 17:14:45 +00:00
2023-06-15 11:37:54 -04:00
2023-06-09 09:47:43 -04:00
2023-09-19 12:30:26 +02:00
2022-11-15 11:51:36 -05:00
2023-11-08 14:09:02 +01:00
2023-06-09 09:52:06 -04:00
2023-09-13 09:53:22 +02:00
2023-06-09 09:59:20 -04:00
2022-11-17 18:06:58 -05:00
2023-06-09 10:38:09 -04:00
2023-05-24 18:03:29 +02:00
2023-05-24 18:03:29 +02:00
2023-08-16 15:46:39 -04:00
2023-10-19 23:10:55 +02:00
2023-06-09 10:50:55 -04:00
2023-06-09 09:51:06 -04:00
2023-06-09 10:40:12 -04:00
2023-06-09 10:36:38 -04:00
2023-11-20 11:57:21 +01:00
2023-10-06 13:16:11 +02:00
2023-06-09 12:31:20 -04:00
2023-06-15 11:06:59 -04:00
2022-10-27 11:42:58 +02:00
2023-03-13 17:27:48 -04:00
2023-03-13 17:27:48 -04:00
2023-06-15 17:55:41 -04:00
2022-12-14 09:48:05 -05:00
2023-09-13 09:53:19 +02:00
2023-06-09 12:49:48 -04:00
2023-06-09 12:49:48 -04:00
2023-09-23 11:14:24 +02:00
2023-11-20 11:57:00 +01:00
2023-09-23 11:14:24 +02:00
2023-06-09 09:43:50 -04:00
2023-06-15 11:37:55 -04:00
2023-06-15 11:37:55 -04:00
2023-06-30 13:11:35 -04:00
2023-06-09 10:41:23 -04:00
2023-10-06 13:16:12 +02:00
2023-03-15 18:45:26 -04:00
2023-03-15 18:45:26 -04:00
2023-07-18 14:42:34 -04:00
2023-06-09 12:48:19 -04:00
2023-03-13 17:27:48 -04:00
2023-06-09 09:53:13 -04:00
2023-01-30 15:37:57 +10:00
2023-03-15 18:45:27 -04:00
2023-06-15 14:33:56 -04:00
2023-06-15 11:06:59 -04:00
2023-10-19 23:11:04 +02:00
2022-10-27 15:12:08 -04:00
2022-10-27 15:12:08 -04:00
2023-07-25 16:16:57 -04:00
2023-09-13 09:53:22 +02:00
2023-06-23 15:33:09 -04:00
2023-06-15 10:42:39 -04:00
2023-06-09 12:44:40 -04:00
2023-10-06 13:16:12 +02:00
2023-06-30 13:12:15 -04:00
2022-10-27 11:42:58 +02:00
2023-06-09 09:42:20 -04:00
2022-10-18 22:08:33 -04:00
2023-08-16 15:46:33 -04:00
2023-10-06 13:16:00 +02:00
2023-06-15 11:37:55 -04:00
2023-06-15 11:37:54 -04:00
2023-06-09 12:32:30 -04:00
2023-04-18 16:28:55 -04:00
2023-09-23 11:14:35 +02:00
2023-06-09 09:25:02 -04:00
2023-06-30 13:12:14 -04:00
2023-06-09 09:53:00 -04:00
2023-01-05 11:43:46 -05:00
2023-01-05 11:43:46 -05:00
2023-06-09 09:48:33 -04:00
2023-01-05 20:34:58 +01:00
2022-11-03 12:45:20 +01:00
2023-04-14 13:47:49 -04:00
2023-06-15 10:42:33 -04:00
2023-09-13 09:53:22 +02:00
2023-06-09 10:38:29 -04:00
2023-02-15 22:24:36 -05:00
2023-06-15 11:06:59 -04:00
2023-06-09 12:44:31 -04:00
2023-06-09 09:48:22 -04:00
2023-06-09 10:38:22 -04:00
2023-06-09 10:38:22 -04:00
2023-11-28 17:14:44 +00:00
2023-06-09 10:41:11 -04:00
2023-06-30 13:12:14 -04:00
2023-03-14 10:37:09 -04:00
2023-11-28 17:14:45 +00:00
2023-07-18 14:42:47 -04:00
2023-03-22 00:47:58 -04:00
2023-10-25 12:16:29 +02:00
2023-07-18 14:42:34 -04:00
2023-06-09 12:41:14 -04:00
2023-08-16 15:46:39 -04:00
2023-07-18 14:42:54 -04:00
2023-06-15 10:43:31 -04:00
2023-03-15 18:45:27 -04:00
2023-09-23 11:14:35 +02:00
2023-06-09 10:41:07 -04:00
2023-09-23 11:14:24 +02:00
2023-05-26 13:52:19 -07:00
2023-01-18 09:25:30 +01:00
2023-01-18 09:25:30 +01:00
2023-06-09 10:57:07 -04:00
2023-09-13 09:53:31 +02:00
2023-01-24 17:36:29 +01:00
2023-01-24 17:36:29 +01:00
2023-01-24 17:36:29 +01:00
2023-01-24 17:36:29 +01:00
2023-02-03 15:37:31 -05:00
2022-12-15 12:19:30 -05:00
2022-12-15 12:19:30 -05:00
2023-10-06 13:16:11 +02:00
2023-10-06 13:16:11 +02:00
2023-10-06 13:16:11 +02:00
2023-10-06 13:16:11 +02:00
2023-04-18 16:28:55 -04:00
2023-06-09 12:34:56 -04:00
2023-10-06 13:16:11 +02:00
2023-06-09 09:49:56 -04:00
2023-06-09 10:37:15 -04:00
2023-11-20 11:57:21 +01:00
2023-06-09 10:38:19 -04:00
2023-01-17 16:11:50 -05:00
2023-11-20 11:57:21 +01:00
2023-06-09 09:40:03 -04:00
2023-07-25 16:15:57 -04:00
2023-06-09 09:49:56 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:17 -04:00
2023-06-09 12:32:35 -04:00
2023-06-09 12:32:35 -04:00
2023-06-15 17:55:41 -04:00
2023-09-06 21:22:20 +01:00
2023-09-06 21:22:20 +01:00
2023-03-13 17:27:48 -04:00
2023-09-23 11:14:24 +02:00
2023-01-25 13:48:16 -05:00
2023-06-09 11:07:00 -04:00
2023-06-09 11:07:00 -04:00
2023-06-09 11:07:00 -04:00
2023-06-09 11:07:00 -04:00
2023-06-09 10:41:58 -04:00
2023-06-09 09:45:58 -04:00
2023-06-09 11:07:00 -04:00
2022-11-17 18:08:27 -05:00
2023-06-09 12:33:42 -04:00
2023-06-15 10:42:42 -04:00
2023-03-15 18:45:26 -04:00
2023-03-15 18:45:26 -04:00
2023-06-09 10:57:13 -04:00
2023-06-09 12:48:19 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 11:08:43 -04:00
2023-06-09 09:53:42 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 12:44:12 -04:00
2023-06-09 12:44:12 -04:00
2022-12-15 12:18:19 -05:00
2022-12-15 12:18:19 -05:00
2022-12-15 12:18:19 -05:00
2022-12-15 12:18:19 -05:00
2022-10-18 22:08:33 -04:00
2023-09-23 11:14:24 +02:00
2023-06-23 15:46:22 -04:00
2023-10-06 13:16:12 +02:00
2023-03-31 11:18:32 -04:00
2023-03-09 22:06:19 -05:00
2023-04-13 00:14:08 -04:00
2023-06-15 14:33:56 -04:00
2023-03-31 11:18:42 -04:00
2023-06-09 10:41:50 -04:00
2023-04-24 18:16:23 -04:00
2023-06-09 09:57:53 -04:00
2023-01-10 14:32:56 -05:00
2023-06-09 10:40:57 -04:00
2022-11-17 18:09:16 -05:00
2023-01-10 14:32:56 -05:00
2023-01-10 14:32:56 -05:00
2023-01-10 14:32:56 -05:00
2023-08-09 10:36:34 -04:00
2023-06-15 11:06:58 -04:00
2023-06-09 10:57:07 -04:00
2023-06-09 10:57:07 -04:00
2023-06-15 11:06:58 -04:00
2023-06-30 13:12:15 -04:00
2023-06-09 09:49:56 -04:00
2023-06-09 09:25:37 -04:00
2023-06-09 10:57:07 -04:00
2023-06-09 10:57:13 -04:00
2023-06-09 12:33:50 -04:00
2023-06-09 10:57:07 -04:00
2023-09-13 09:53:31 +02:00
2023-06-09 09:21:03 -04:00
2023-02-14 15:47:15 -05:00
2023-02-14 15:47:15 -05:00
2023-06-09 09:48:33 -04:00
2023-06-09 09:48:36 -04:00
2023-06-09 10:37:08 -04:00
2023-06-09 12:40:01 -04:00
2023-06-09 09:49:39 -04:00
2022-12-02 10:04:45 -05:00
2023-10-06 13:16:11 +02:00
2023-06-15 11:06:59 -04:00
2023-01-05 11:43:46 -05:00
2022-10-11 11:04:55 -04:00
2023-04-11 18:03:44 -04:00
2022-10-17 17:41:21 -04:00
2022-10-11 11:05:23 -04:00
2023-06-09 12:44:31 -04:00
2023-06-15 11:06:59 -04:00
2022-11-03 12:45:20 +01:00
2023-06-09 09:40:03 -04:00
2023-06-09 09:40:03 -04:00
2023-04-14 13:47:49 -04:00
2023-06-09 09:41:43 -04:00
2023-06-09 09:40:03 -04:00
2023-06-09 10:41:13 -04:00
2023-06-09 12:44:12 -04:00
2023-06-09 10:54:37 -04:00
2023-06-09 09:41:27 -04:00
2023-06-30 13:12:15 -04:00
2022-11-17 18:08:20 -05:00
2023-09-23 11:14:24 +02:00
2023-09-23 11:14:24 +02:00
2023-11-02 09:36:50 +01:00