mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: Tristan Madani <tristmd@gmail.com>
Cc: Azael Avalos <coproscefalo@gmail.com>,
	Hans de Goede <hansg@kernel.org>,
	 platform-driver-x86@vger.kernel.org,
	LKML <linux-kernel@vger.kernel.org>,
	 stable@vger.kernel.org,
	Tristan Madani <tristan@talencesecurity.com>
Subject: Re: [PATCH] platform/x86: toshiba_acpi: validate ACPI object type in tci_raw()
Date: Mon, 9 Nov 2026 18:24:14 +0200 (EET)	[thread overview]
Message-ID: <7ac2114f-f4a5-c94a-0578-7659a7a291eb@linux.intel.com> (raw)
In-Reply-To: <20261102181827.1989460-1-tristan@talencesecurity.com>

On Mon, 2 Nov 2026, Tristan Madani wrote:

> tci_raw() calls acpi_evaluate_object() and uses the returned buffer as
> an ACPI_TYPE_PACKAGE without checking its type field. If the ACPI method
> returns a different object type, accessing package.count and
> package.elements interprets whatever data the union holds as a package
> descriptor.
> 
> Add a type check before accessing the package fields. Return AE_TYPE
> when the result is not a package, when the package has more elements
> than TCI_WORDS, or when any element is not an ACPI_TYPE_INTEGER.

Your ACPI validation patches seem to lack information whether these 
actually have been observed to occur on some device.

> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable@vger.kernel.org
> Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
> ---
>  drivers/platform/x86/toshiba_acpi.c | 17 ++++++++++++++---
>  1 file changed, 14 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/platform/x86/toshiba_acpi.c b/drivers/platform/x86/toshiba_acpi.c
> index a0b8060836d01..4ccc8f51c3a5b 100644
> --- a/drivers/platform/x86/toshiba_acpi.c
> +++ b/drivers/platform/x86/toshiba_acpi.c
> @@ -342,9 +342,20 @@ static acpi_status tci_raw(struct toshiba_acpi_dev *dev,
>  	status = acpi_evaluate_object(dev->acpi_dev->handle,
>  				      (char *)dev->method_hci, &params,
>  				      &results);
> -	if ((status == AE_OK) && (out_objs->package.count <= TCI_WORDS)) {
> -		for (i = 0; i < out_objs->package.count; ++i)
> -			out[i] = out_objs->package.elements[i].integer.value;
> +	if (status == AE_OK) {
> +		if (out_objs->type == ACPI_TYPE_PACKAGE &&
> +		    out_objs->package.count <= TCI_WORDS) {
> +			for (i = 0; i < out_objs->package.count; ++i) {
> +				if (out_objs->package.elements[i].type !=
> +				    ACPI_TYPE_INTEGER) {
> +					status = AE_TYPE;
> +					break;
> +				}
> +				out[i] = out_objs->package.elements[i].integer.value;
> +			}
> +		} else {
> +			status = AE_TYPE;
> +		}
>  	}
>  
>  	return status;
> 

-- 
 i.


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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-02 18:18 Tristan Madani
2026-11-09 16:24 ` Ilpo Järvinen [this message]

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=7ac2114f-f4a5-c94a-0578-7659a7a291eb@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=coproscefalo@gmail.com \
    --cc=hansg@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=tristan@talencesecurity.com \
    --cc=tristmd@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®