Commit 1abb2648 authored by Jiang Liu's avatar Jiang Liu Committed by Alex Deucher
Browse files

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: default avatarLijo Lazar <lijo.lazar@amd.com>
Signed-off-by: default avatarJiang Liu <gerry@linux.alibaba.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
parent d584198a
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -612,7 +612,8 @@ static int smu_sys_set_pp_table(void *handle,
		return -EIO;
	}

	if (!smu_table->hardcode_pptable) {
	if (!smu_table->hardcode_pptable || smu_table->power_play_table_size < size) {
		kfree(smu_table->hardcode_pptable);
		smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
		if (!smu_table->hardcode_pptable)
			return -ENOMEM;