[PATCH 4/5] platform/x86: dell: dcdbas: Validate the WSMT buffer description
From: Rosen Penev
Date: Sat Nov 14 2026 - 01:19:11 EST
dcdbas_check_wsmt() takes the address and size of the firmware SMI
buffer from an SMBIOS OEM string or from an EPS table in the BIOS area,
and sets
smi_buf.size = remap_size - 8;
max_smi_data_buf_size = smi_buf.size;
without checking that remap_size is larger than the 8 byte semaphore.
An OEM string such as "30[addr;0]" or an EPS table with
num_of_4k_pages == 0 makes the size wrap to almost 2^64, and smi_data
reads and writes can then access memory well past the mapping.
check_eps_table() also accepts a table with length 0, since the
checksum of zero bytes is zero, and then trusts the rest of it.
Reject buffers of 8 bytes or less, and EPS tables shorter than
struct smm_eps_table.
Fixes: 12c956c4f32e ("firmware: dcdbas: Add support for WSMT ACPI table")
Fixes: 47a94c551a74 ("platform/x86: dcdbas: Check SMBIOS for protected buffer address")
Signed-off-by: Rosen Penev <rosenp@xxxxxxxxx>
---
drivers/platform/x86/dell/dcdbas.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/drivers/platform/x86/dell/dcdbas.c b/drivers/platform/x86/dell/dcdbas.c
index d5a93aca9c93..af4c1d2fe497 100644
--- a/drivers/platform/x86/dell/dcdbas.c
+++ b/drivers/platform/x86/dell/dcdbas.c
@@ -540,6 +540,9 @@ static inline struct smm_eps_table *check_eps_table(u8 *addr)
if (strncmp(eps->smm_comm_buff_anchor, SMM_EPS_SIG, 4) != 0)
return NULL;
+ if (eps->length < sizeof(*eps))
+ return NULL;
+
if (checksum(addr, eps->length) != 0)
return NULL;
@@ -600,6 +603,12 @@ static int dcdbas_check_wsmt(void)
dev_warn(&dcdbas_pdev->dev, "found WSMT, but buffer address is above 4GB\n");
return -EINVAL;
}
+ /* The first 8 bytes are a semaphore, so there must be room after them */
+ if (remap_size <= 8) {
+ dev_warn(&dcdbas_pdev->dev, "found WSMT, but buffer size %llu is too small\n",
+ remap_size);
+ return -EINVAL;
+ }
/*
* Limit remap size to MAX_SMI_DATA_BUF_SIZE + 8 (since the first 8
* bytes are used for a semaphore, not the data buffer itself).
--
2.56.0