Skip to content

Commit 1abb264

Browse files
jiangliualexdeucher
authored andcommitted
drm/amdgpu: avoid buffer overflow attach in smu_sys_set_pp_table()
It malicious user provides a small pptable through sysfs and then a bigger pptable, it may cause buffer overflow attack in function smu_sys_set_pp_table(). Reviewed-by: Lijo Lazar <lijo.lazar@amd.com> Signed-off-by: Jiang Liu <gerry@linux.alibaba.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Cc: stable@vger.kernel.org
1 parent d584198 commit 1abb264

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,8 @@ static int smu_sys_set_pp_table(void *handle,
612612
return -EIO;
613613
}
614614

615-
if (!smu_table->hardcode_pptable) {
615+
if (!smu_table->hardcode_pptable || smu_table->power_play_table_size < size) {
616+
kfree(smu_table->hardcode_pptable);
616617
smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
617618
if (!smu_table->hardcode_pptable)
618619
return -ENOMEM;

0 commit comments

Comments
 (0)