amdgpu/pm: prevent array underflow in vega20_odn_edit_dpm_table()
authorDan Carpenter <error27@gmail.com>
Tue, 15 Nov 2022 12:56:57 +0000 (15:56 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 31 Dec 2022 12:14:10 +0000 (13:14 +0100)
commitf289a38df0da4cfe4b50d04b1b9c3bc646fecd57
tree40f88a5c742d081d9ef7b87a7eb05223f56b9cd0
parentcda1895f3b7f324ece1614308a815a3994983b97
amdgpu/pm: prevent array underflow in vega20_odn_edit_dpm_table()

[ Upstream commit d27252b5706e51188aed7647126e44dcf9e940c1 ]

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: d5bf26539494 ("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>
drivers/gpu/drm/amd/pm/powerplay/hwmgr/vega20_hwmgr.c