Skip to content

Commit d524d40

Browse files
Umio-Yasunoalexdeucher
authored andcommitted
drm/amd/pm: fix null pointer access
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 <[email protected]> Acked-by: Alex Deucher <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 82a7c94 commit d524d40

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/gpu/drm/amd/pm/amdgpu_pm.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1398,6 +1398,8 @@ static ssize_t amdgpu_set_pp_power_profile_mode(struct device *dev,
13981398
if (ret)
13991399
return -EINVAL;
14001400
parameter_size++;
1401+
if (!tmp_str)
1402+
break;
14011403
while (isspace(*tmp_str))
14021404
tmp_str++;
14031405
}
@@ -3645,6 +3647,9 @@ static int parse_input_od_command_lines(const char *buf,
36453647
return -EINVAL;
36463648
parameter_size++;
36473649

3650+
if (!tmp_str)
3651+
break;
3652+
36483653
while (isspace(*tmp_str))
36493654
tmp_str++;
36503655
}

0 commit comments

Comments
 (0)