Skip to content

Commit

Permalink
amdgpu/pm: prevent array underflow in vega20_odn_edit_dpm_table()
Browse files Browse the repository at this point in the history
[ Upstream commit d27252b ]

In the PP_OD_EDIT_VDDC_CURVE case the "input_index" variable is capped at
2 but not checked for negative values so it results in an out of bounds
read.  This value comes from the user via sysfs.

Fixes: d5bf265 ("drm/amd/powerplay: added vega20 overdrive support V3")
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
error27 authored and gregkh committed Dec 31, 2022
1 parent 2f98469 commit 8084bd0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2961,7 +2961,8 @@ static int vega20_odn_edit_dpm_table(struct pp_hwmgr *hwmgr,
data->od8_settings.od8_settings_array;
OverDriveTable_t *od_table =
&(data->smc_state_table.overdrive_table);
int32_t input_index, input_clk, input_vol, i;
int32_t input_clk, input_vol, i;
uint32_t input_index;
int od8_id;
int ret;

Expand Down

0 comments on commit 8084bd0

Please sign in to comment.