diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-11-30 02:37:04 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2023-11-30 02:37:04 +0000 |
commit | be4852bb3cca0f453bd33a007536f2f2b7c94e76 (patch) | |
tree | 7835519a80a133c82c798ff16135c8c0166f33d8 /sys | |
parent | 666c8bb78e29b705480ed1457adf7879703f6b41 (diff) |
drm/amdgpu: Fix a null pointer access when the smc_rreg pointer is NULL
From Qu Huang
6c1b3d89a2dda79881726bb6e37af19c0936d736 in linux-6.1.y/6.1.64
5104fdf50d326db2c1a994f8b35dcd46e63ae4ad in mainline linux
Diffstat (limited to 'sys')
-rw-r--r-- | sys/dev/pci/drm/amd/amdgpu/amdgpu_debugfs.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/dev/pci/drm/amd/amdgpu/amdgpu_debugfs.c b/sys/dev/pci/drm/amd/amdgpu/amdgpu_debugfs.c index de61a85c4b0..fd796574f87 100644 --- a/sys/dev/pci/drm/amd/amdgpu/amdgpu_debugfs.c +++ b/sys/dev/pci/drm/amd/amdgpu/amdgpu_debugfs.c @@ -589,6 +589,9 @@ static ssize_t amdgpu_debugfs_regs_smc_read(struct file *f, char __user *buf, ssize_t result = 0; int r; + if (!adev->smc_rreg) + return -EPERM; + if (size & 0x3 || *pos & 0x3) return -EINVAL; @@ -645,6 +648,9 @@ static ssize_t amdgpu_debugfs_regs_smc_write(struct file *f, const char __user * ssize_t result = 0; int r; + if (!adev->smc_wreg) + return -EPERM; + if (size & 0x3 || *pos & 0x3) return -EINVAL; |