Commit d524d40e authored by Umio Yasuno's avatar Umio Yasuno Committed by Alex Deucher
Browse files

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: default avatarUmio Yasuno <coelacanth_dream@protonmail.com>
Acked-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 82a7c94f
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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++;
	}