|
|
ed5979 |
From 8b0c5c6d356fd6cce9092727e20097b70e07bba9 Mon Sep 17 00:00:00 2001
|
|
|
ed5979 |
From: Julia Suvorova <jusual@redhat.com>
|
|
|
ed5979 |
Date: Thu, 23 Feb 2023 13:57:47 +0100
|
|
|
ed5979 |
Subject: [PATCH] hw/smbios: fix field corruption in type 4 table
|
|
|
ed5979 |
|
|
|
ed5979 |
RH-Author: Julia Suvorova <None>
|
|
|
ed5979 |
RH-MergeRequest: 156: hw/smbios: fix field corruption in type 4 table
|
|
|
ed5979 |
RH-Bugzilla: 2169904
|
|
|
ed5979 |
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: MST <mst@redhat.com>
|
|
|
ed5979 |
RH-Acked-by: Ani Sinha <None>
|
|
|
ed5979 |
RH-Commit: [1/1] ee6d9bb6dfa0fb2625915947072cb91a0926c4ec
|
|
|
ed5979 |
|
|
|
ed5979 |
Since table type 4 of SMBIOS version 2.6 is shorter than 3.0, the
|
|
|
ed5979 |
strings which follow immediately after the struct fields have been
|
|
|
ed5979 |
overwritten by unconditional filling of later fields such as core_count2.
|
|
|
ed5979 |
Make these fields dependent on the SMBIOS version.
|
|
|
ed5979 |
|
|
|
ed5979 |
Fixes: 05e27d74c7 ("hw/smbios: add core_count2 to smbios table type 4")
|
|
|
ed5979 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2169904
|
|
|
ed5979 |
|
|
|
ed5979 |
Signed-off-by: Julia Suvorova <jusual@redhat.com>
|
|
|
ed5979 |
Message-Id: <20230223125747.254914-1-jusual@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
|
|
|
ed5979 |
Reviewed-by: Ani Sinha <ani@anisinha.ca>
|
|
|
ed5979 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ed5979 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
ed5979 |
(cherry picked from commit 60d09b8dc7dd4256d664ad680795cb1327805b2b)
|
|
|
ed5979 |
---
|
|
|
ed5979 |
hw/smbios/smbios.c | 8 +++++---
|
|
|
ed5979 |
1 file changed, 5 insertions(+), 3 deletions(-)
|
|
|
ed5979 |
|
|
|
ed5979 |
diff --git a/hw/smbios/smbios.c b/hw/smbios/smbios.c
|
|
|
ed5979 |
index c5ad69237e..2d2ece3edb 100644
|
|
|
ed5979 |
--- a/hw/smbios/smbios.c
|
|
|
ed5979 |
+++ b/hw/smbios/smbios.c
|
|
|
ed5979 |
@@ -752,14 +752,16 @@ static void smbios_build_type_4_table(MachineState *ms, unsigned instance)
|
|
|
ed5979 |
t->core_count = (ms->smp.cores > 255) ? 0xFF : ms->smp.cores;
|
|
|
ed5979 |
t->core_enabled = t->core_count;
|
|
|
ed5979 |
|
|
|
ed5979 |
- t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
|
|
|
ed5979 |
-
|
|
|
ed5979 |
t->thread_count = (ms->smp.threads > 255) ? 0xFF : ms->smp.threads;
|
|
|
ed5979 |
- t->thread_count2 = cpu_to_le16(ms->smp.threads);
|
|
|
ed5979 |
|
|
|
ed5979 |
t->processor_characteristics = cpu_to_le16(0x02); /* Unknown */
|
|
|
ed5979 |
t->processor_family2 = cpu_to_le16(0x01); /* Other */
|
|
|
ed5979 |
|
|
|
ed5979 |
+ if (tbl_len == SMBIOS_TYPE_4_LEN_V30) {
|
|
|
ed5979 |
+ t->core_count2 = t->core_enabled2 = cpu_to_le16(ms->smp.cores);
|
|
|
ed5979 |
+ t->thread_count2 = cpu_to_le16(ms->smp.threads);
|
|
|
ed5979 |
+ }
|
|
|
ed5979 |
+
|
|
|
ed5979 |
SMBIOS_BUILD_TABLE_POST;
|
|
|
ed5979 |
smbios_type4_count++;
|
|
|
ed5979 |
}
|
|
|
ed5979 |
--
|
|
|
ed5979 |
2.31.1
|
|
|
ed5979 |
|