[PATCH] drm/amd/pm: fix null pointer access

Alex Deucher alexdeucher at gmail.com
Wed Jul 16 17:43:55 UTC 2025


Applied.  Thanks!

Alex

On Wed, Jul 16, 2025 at 3:28 AM Umio Yasuno
<coelacanth_dream at protonmail.com> wrote:
>
> Writing a string without delimiters (' ', '\n', '\0') to the under
> gpu_od/fan_ctrl sysfs or pp_power_profile_mode for the CUSTOM profile
> will result in a null pointer dereference.
>
> Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/4401
>
> Signed-off-by: Umio Yasuno <coelacanth_dream at protonmail.com>
> Acked-by: Alex Deucher <alexander.deucher at amd.com>
> ---
> Thank you for your comment. I just fixed the patch message.
>
>  drivers/gpu/drm/amd/pm/amdgpu_pm.c | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> index edd9895b4..39ee81085 100644
> --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> @@ -1398,6 +1398,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
>                         if (ret)
>                                 return -EINVAL;
>                         parameter_size++;
> +                       if (!tmp_str)
> +                               break;
>                         while (isspace(*tmp_str))
>                                 tmp_str++;
>                 }
> @@ -3645,6 +3647,9 @@ static int parse_input_od_command_lines(const char *buf,
>                         return -EINVAL;
>                 parameter_size++;
>
> +               if (!tmp_str)
> +                       break;
> +
>                 while (isspace(*tmp_str))
>                         tmp_str++;
>         }
> --
> 2.47.2
>
>


More information about the amd-gfx mailing list