Patch "drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     drm-amdgpu-fix-cat-debugfs-amdgpu_regs_didt-causes-k.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 88dd169f257cfce5a4f25371f0c5cc31426ac776
Author: Lu Yao <yaolu@xxxxxxxxxx>
Date:   Thu Nov 23 09:22:34 2023 +0800

    drm/amdgpu: Fix cat debugfs amdgpu_regs_didt causes kernel null pointer
    
    [ Upstream commit 2161e09cd05a50d80736fe397145340d2e8f6c05 ]
    
    For 'AMDGPU_FAMILY_SI' family cards, in 'si_common_early_init' func, init
    'didt_rreg' and 'didt_wreg' to 'NULL'. But in func
    'amdgpu_debugfs_regs_didt_read/write', using 'RREG32_DIDT' 'WREG32_DIDT'
    lacks of relevant judgment. And other 'amdgpu_ip_block_version' that use
    these two definitions won't be added for 'AMDGPU_FAMILY_SI'.
    
    So, add null pointer judgment before calling.
    
    Reviewed-by: Christian König <christian.koenig@xxxxxxx>
    Signed-off-by: Lu Yao <yaolu@xxxxxxxxxx>
    Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
index fd796574f87a..8123feb1a116 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_debugfs.c
@@ -479,6 +479,9 @@ static ssize_t amdgpu_debugfs_regs_didt_read(struct file *f, char __user *buf,
 	if (size & 0x3 || *pos & 0x3)
 		return -EINVAL;
 
+	if (!adev->didt_rreg)
+		return -EOPNOTSUPP;
+
 	r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
 	if (r < 0) {
 		pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);
@@ -535,6 +538,9 @@ static ssize_t amdgpu_debugfs_regs_didt_write(struct file *f, const char __user
 	if (size & 0x3 || *pos & 0x3)
 		return -EINVAL;
 
+	if (!adev->didt_wreg)
+		return -EOPNOTSUPP;
+
 	r = pm_runtime_get_sync(adev_to_drm(adev)->dev);
 	if (r < 0) {
 		pm_runtime_put_autosuspend(adev_to_drm(adev)->dev);




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux