Skip to content

Commit e3f0381

Browse files
jiangliuaaron-ang
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 <[email protected]> Signed-off-by: Jiang Liu <[email protected]> Signed-off-by: Alex Deucher <[email protected]> Cc: [email protected]
1 parent 19c221a commit e3f0381

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)