mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
drm/amdgpu: avoid buffer overflow attach in smu_sys_set_pp_table()
commit 1abb2648698bf10783d2236a6b4a7ca5e8021699 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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
781a06fd26
commit
3484ea3315
@@ -516,7 +516,8 @@ static int smu_sys_set_pp_table(void *handle,
|
|||||||
return -EIO;
|
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);
|
smu_table->hardcode_pptable = kzalloc(size, GFP_KERNEL);
|
||||||
if (!smu_table->hardcode_pptable)
|
if (!smu_table->hardcode_pptable)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|||||||
Reference in New Issue
Block a user