Skip to content

Commit 3e5d612

Browse files
jiangliujfvogel
authored andcommitted
drm/amdgpu: avoid buffer overflow attach in smu_sys_set_pp_table()
commit 1abb264 upstream. 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] Signed-off-by: Greg Kroah-Hartman <[email protected]> (cherry picked from commit 2498d2db1d35e88a2060ea191ae75dce853dd084) Signed-off-by: Jack Vogel <[email protected]>
1 parent 3d3a43f commit 3e5d612

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
@@ -607,7 +607,8 @@ static int smu_sys_set_pp_table(void *handle,
607607
return -EIO;
608608
}
609609

610-
if (!smu_table->hardcode_pptable) {
610+
if (!smu_table->hardcode_pptable || smu_table->power_play_table_size < size) {
611+
kfree(smu_table->hardcode_pptable);
611612
smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
612613
if (!smu_table->hardcode_pptable)
613614
return -ENOMEM;

0 commit comments

Comments
 (0)