Re: [PATCH] drm/amd/pm: Init pm_attr_list when dpm is disabled

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

 



On Wed, Oct 12, 2022 at 5:36 AM ZhenGuo Yin <zhenguo.yin@xxxxxxx> wrote:
>
> [Why]
> In SRIOV multi-vf, dpm is always disabled, and pm_attr_list won't
> be initialized. There will be a NULL pointer call trace after
> removing the dpm check condition in amdgpu_pm_sysfs_fini.
> BUG: kernel NULL pointer dereference, address: 0000000000000000
> RIP: 0010:amdgpu_device_attr_remove_groups+0x20/0x90 [amdgpu]
> Call Trace:
>   <TASK>
>   amdgpu_pm_sysfs_fini+0x2f/0x40 [amdgpu]
>   amdgpu_device_fini_hw+0xdf/0x290 [amdgpu]
>
> [How]
> List pm_attr_list should be initialized when dpm is disabled.
>
> Fiexes:894483d76ada ("drm/amd/pm: Remove redundant check condition")

typo.  Should be:
Fixes: 894483d76ada ("drm/amd/pm: Remove redundant check condition")

Either this patch or reverting 894483d76ada is fine with me.  Either way:
Reviewed-by: Alex Deucher <alexander.deucher@xxxxxxx>

> Signed-off-by: ZhenGuo Yin <zhenguo.yin@xxxxxxx>
> ---
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> index 948cc75376f8..236657eece47 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> @@ -3362,11 +3362,11 @@ int amdgpu_pm_sysfs_init(struct amdgpu_device *adev)
>         if (adev->pm.sysfs_initialized)
>                 return 0;
>
> +       INIT_LIST_HEAD(&adev->pm.pm_attr_list);
> +
>         if (adev->pm.dpm_enabled == 0)
>                 return 0;
>
> -       INIT_LIST_HEAD(&adev->pm.pm_attr_list);
> -
>         adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev,
>                                                                    DRIVER_NAME, adev,
>                                                                    hwmon_groups);
> --
> 2.35.1
>



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux