mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Rosen Penev <rosenp@gmail.com>
Cc: "Stuart Hayes" <stuart.w.hayes@gmail.com>,
	"Hans de Goede" <hansg@kernel.org>,
	"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
	"Doug Warzecha" <Douglas_Warzecha@dell.com>,
	"Andrew Morton" <akpm@osdl.org>,
	platform-driver-x86@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 4/5] platform/x86: dell: dcdbas: Validate the WSMT buffer description
Date: Mon, 16 Nov 2026 13:43:27 +0200	[thread overview]
Message-ID: <avrsX3FsTveIu8fJ@ashevche-desk.local> (raw)
In-Reply-To: <e2f8ce920d1fe503bf8b506f3cea2a0b72187261.1794633178.git.rosenp@gmail.com>

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



  reply	other threads:[~2026-11-16 11:43 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-14  6:17 [PATCH 0/5] platform/x86: dell: dcdbas: Fix SMI completion wait and buffer handling Rosen Penev
2026-11-14  6:17 ` [PATCH 1/5] platform/x86: dell: dcdbas: Actually wait for the host control SMI Rosen Penev
2026-11-16 11:17   ` Andy Shevchenko
2026-11-14  6:17 ` [PATCH 2/5] platform/x86: dell: dcdbas: Suppress bind attributes of the platform driver Rosen Penev
2026-11-16 11:18   ` Andy Shevchenko
2026-11-14  6:17 ` [PATCH 3/5] platform/x86: dell: dcdbas: Release the SMI buffer in remove Rosen Penev
2026-11-16 11:24   ` Andy Shevchenko
2026-11-14  6:17 ` [PATCH 4/5] platform/x86: dell: dcdbas: Validate the WSMT buffer description Rosen Penev
2026-11-16 11:43   ` Andy Shevchenko [this message]
2026-11-14  6:17 ` [PATCH 5/5] platform/x86: dell: dcdbas: Use read_poll_timeout_atomic() for the type 1 SMI Rosen Penev
2026-11-16 11:44   ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=avrsX3FsTveIu8fJ@ashevche-desk.local \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Douglas_Warzecha@dell.com \
    --cc=akpm@osdl.org \
    --cc=hansg@kernel.org \
    --cc=ilpo.jarvinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=rosenp@gmail.com \
    --cc=stuart.w.hayes@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®