diff options
| author | Yazen Ghannam <yazen.ghannam@amd.com> | 2026-11-23 17:26:59 -0600 |
|---|---|---|
| committer | Borislav Petkov (AMD) <bp@alien8.de> | 2026-11-23 16:35:45 -0800 |
| commit | d734667216e3fe13f0d81231f0e5691816ec42f4 (patch) | |
| tree | 664c85fd5501f716dc534b907bf22339043d5890 /tools/lib/python/kdoc/parse_data_structs.py | |
| parent | 86d477c009ed7f3a24b420b7f4aa314fabe36be3 (diff) | |
x86/mce/amd: Fix bank lookup in amd_mce_usable_address()
amd_mce_usable_address() reads the per-CPU smca_banks array at index m->bank
on the running CPU. The index is not checked, and the bank belongs to
m->extcpu, not to whichever CPU is decoding.
m->bank is unbounded here. apei_mce_report_mem_error() sets it to -1, which is
255 in the u8 field, and apei_smca_report_x86_error() takes it from a firmware
CPER record (BERT or GHES). Both reach this function through the decoder
chain, which runs from a workqueue on any CPU. Bank counts can differ per CPU
on SMCA systems. So the read can land past the end of the array, or on a CPU
where that bank means something else.
Use m->extcpu for both the bound and the lookup. A bank number outside that
CPU's range makes the record inconsistent. Don't act on such a record: report
its address as not usable.
Fixes: 821f5fe4dbcb ("x86/mce: Add support for physical address valid bit")
Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20261123232701.1923094-2-yazen.ghannam@amd.com
Diffstat (limited to 'tools/lib/python/kdoc/parse_data_structs.py')
0 files changed, 0 insertions, 0 deletions
