Skip to content

Commit 231075c

Browse files
jiangliugregkh
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 <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 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 8b3d71b commit 231075c

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

612-
if (!smu_table->hardcode_pptable) {
612+
if (!smu_table->hardcode_pptable || smu_table->power_play_table_size < size) {
613+
kfree(smu_table->hardcode_pptable);
613614
smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
614615
if (!smu_table->hardcode_pptable)
615616
return -ENOMEM;

0 commit comments

Comments
 (0)