Re: [PATCH 4/5] platform/x86: dell: dcdbas: Validate the WSMT buffer description

From: Andy Shevchenko

Date: Mon Nov 16 2026 - 06:43:47 EST


On Fri, Nov 13, 2026 at 10:17:57PM -0800, Rosen Penev wrote:
> 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.

Are they real or just based on the code reading?

> Fixes: 12c956c4f32e ("firmware: dcdbas: Add support for WSMT ACPI table")
> Fixes: 47a94c551a74 ("platform/x86: dcdbas: Check SMBIOS for protected buffer address")

If they are only based on the code reading, I would drop these fixes tags and
make commit message to sound that it's hardening of the existing code.

...

> + /* The first 8 bytes are a semaphore, so there must be room after them */
> + if (remap_size <= 8) {

Why '=' is here? We probably should rely on memremap() to complain on 0 length.

> + dev_warn(&dcdbas_pdev->dev, "found WSMT, but buffer size %llu is too small\n",
> + remap_size);
> + return -EINVAL;
> + }


--
With Best Regards,
Andy Shevchenko