summaryrefslogtreecommitdiff
path: root/sys/dev/pci
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2024-11-25 00:17:35 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2024-11-25 00:17:35 +0000
commit9946e22f2a24e339bf3b20fc8f640700b0d8a764 (patch)
treef4078575102177bb271c8bbeb402640ca2fb6f5b /sys/dev/pci
parent2fa20895b557d1aa0e94f4e8d6b491ce911fe3fd (diff)
drm/amd/pm: Vangogh: Fix kernel memory out of bounds writeHEADmastercvs/HEAD
From Tvrtko Ursulin f111de0f010308949254ee1cc45df8e6b8e1d7d4 in linux-6.6.y/6.6.63 4aa923a6e6406b43566ef6ac35a3d9a3197fa3e8 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r--sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c b/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
index c242656d16a..416b1872f8d 100644
--- a/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
+++ b/sys/dev/pci/drm/amd/pm/swsmu/smu11/vangogh_ppt.c
@@ -256,10 +256,9 @@ static int vangogh_tables_init(struct smu_context *smu)
goto err0_out;
smu_table->metrics_time = 0;
- if (smu_version >= 0x043F3E00)
- smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_3);
- else
- smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2);
+ smu_table->gpu_metrics_table_size = sizeof(struct gpu_metrics_v2_2);
+ smu_table->gpu_metrics_table_size = max(smu_table->gpu_metrics_table_size, sizeof(struct gpu_metrics_v2_3));
+ smu_table->gpu_metrics_table_size = max(smu_table->gpu_metrics_table_size, sizeof(struct gpu_metrics_v2_4));
smu_table->gpu_metrics_table = kzalloc(smu_table->gpu_metrics_table_size, GFP_KERNEL);
if (!smu_table->gpu_metrics_table)
goto err1_out;