mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Luck, Tony" <tony.luck@intel.com>
To: Kang Chen <k.chen@smail.nju.edu.cn>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Len Brown <lenb@kernel.org>, Borislav Petkov <bp@suse.de>,
	<linux-acpi@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ACPI: ADXL: verify component name types
Date: Tue, 3 Nov 2026 09:05:26 -0800	[thread overview]
Message-ID: <auoUVk7-jBYwmvvB@agluck-desk3> (raw)
In-Reply-To: <20261103114149.76010-1-k.chen@smail.nju.edu.cn>

On Tue, Nov 03, 2026 at 07:41:49PM +0800, Kang Chen wrote:
> adxl_init() stores p[i].string.pointer for every component name
> without checking that the element is a string.  An integer element
> makes the pointer the integer value, which adxl_decode() consumers
> dereference with strcmp() and %s, causing a wild read during boot on
> machines with an ADXL object.
> 
> Reject the interface if any component name is not a string.

Has this ever happened on a real system? Or is this just an:

	"AI told me there was a *potential* bug" 

issue?


> 
> Fixes: 4cf841e39850 ("ACPI/ADXL: Add address translation interface using an ACPI DSM")
> Signed-off-by: Kang Chen <k.chen@smail.nju.edu.cn>
> ---
>  drivers/acpi/acpi_adxl.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/acpi_adxl.c b/drivers/acpi/acpi_adxl.c
> index 13c8f7b50c46..de646b312eba 100644
> --- a/drivers/acpi/acpi_adxl.c
> +++ b/drivers/acpi/acpi_adxl.c
> @@ -184,8 +184,17 @@ static int __init adxl_init(void)
>  		return -ENOMEM;
>  	}
>  
> -	for (i = 0; i < adxl_count; i++)
> +	for (i = 0; i < adxl_count; i++) {
> +		if (p[i].type != ACPI_TYPE_STRING) {
> +			pr_info("Bad component name type %d\n", p[i].type);

If this really happens, then Linux has a way to point a finger at the
source of the problem:

			pr_info(FW_BUG "Bad component name type %d\n", p[i].type);

> +			kfree(adxl_component_names);
> +			adxl_component_names = NULL;
> +			ACPI_FREE(params);
> +			params = NULL;
> +			return -ENODEV;
> +		}
>  		adxl_component_names[i] = p[i].string.pointer;
> +	}
>  
>  	return 0;
>  }
> -- 
> 2.34.1
> 
-Tony

      reply	other threads:[~2026-11-03 17:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 11:41 Kang Chen
2026-11-03 17:05 ` Luck, Tony [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=auoUVk7-jBYwmvvB@agluck-desk3 \
    --to=tony.luck@intel.com \
    --cc=bp@suse.de \
    --cc=k.chen@smail.nju.edu.cn \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /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®