Reviewed and applied the series. Thanks!
Alex On Wed, Oct 28, 2026 at 9:06 AM Amadeusz Sławiński <[email protected]> wrote: > > Running > cat /sys/kernel/debug/dri/0/psp_spirom_dump > with amdgpu card that doesn't support it leads to nullptr dereference. > Add checks to prevent that. > > Signed-off-by: Amadeusz Sławiński <[email protected]> > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c | 6 ++++++ > drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h | 2 +- > 2 files changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c > index 82a2684dbd2e..627c74f16914 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c > @@ -5381,6 +5381,9 @@ static int psp_read_spirom_debugfs_open(struct inode > *inode, struct file *filp) > struct spirom_bo *bo_triplet; > int ret; > > + if (!adev->psp.funcs || !adev->psp.funcs->dump_spirom) > + return -EOPNOTSUPP; > + > /* serialize the open() file calling */ > if (!mutex_trylock(&adev->psp.mutex)) > return -EBUSY; > @@ -5473,6 +5476,9 @@ void amdgpu_psp_debugfs_init(struct amdgpu_device *adev) > #if defined(CONFIG_DEBUG_FS) > struct drm_minor *minor = adev_to_drm(adev)->primary; > > + if (!adev->psp.funcs || !adev->psp.funcs->dump_spirom) > + return; > + > debugfs_create_file_size("psp_spirom_dump", 0444, minor->debugfs_root, > adev, &psp_dump_spirom_debugfs_ops, > AMD_VBIOS_FILE_MAX_SIZE_B * 2); > #endif > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h > b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h > index a4ec60f6c317..975d12359358 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_psp.h > @@ -574,7 +574,7 @@ struct amdgpu_psp_funcs { > (psp)->funcs->update_spirom((psp), fw_pri_mc_addr) : -EINVAL) > > #define psp_dump_spirom(psp, fw_pri_mc_addr) \ > - ((psp)->funcs->dump_spirom ? \ > + (((psp)->funcs && (psp)->funcs->dump_spirom) ? \ > (psp)->funcs->dump_spirom((psp), fw_pri_mc_addr) : -EINVAL) > > #define psp_vbflash_status(psp) \ > > base-commit: 83f32c773255720a661aa45d83e36278135f23f5 > -- > 2.56.0 >
