All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Muhammad Bilal" <meatuni001@gmail.com>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH] hwmon: (hp-wmi-sensors) Accept raw WMI strings in numeric sensor properties
Date: Wed, 16 Sep 2026 00:38:54 +0000	[thread overview]
Message-ID: <20260916003854.B65751F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260916002907.161210-1-meatuni001@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] hwmon: hp-wmi-sensors: arbitrary pointer dereference due to skipped switch block
--

commit ee807beabcd26889b2a01e5199b2f1dec6b26303
Author: Muhammad Bilal <meatuni001@gmail.com>

hwmon: (hp-wmi-sensors) Accept raw WMI strings in numeric sensor properties

This commit gives check_numeric_sensor_wobj() the same is_raw_wmi_string()
exception as check_wobj(). This allows BIOS-reported WMI strings encoded as
a length-prefixed UTF-16 ACPI_TYPE_BUFFER to be properly recognized.

> diff --git a/drivers/hwmon/hp-wmi-sensors.c b/drivers/hwmon/hp-wmi-sensors.c
> index 03c684ba83bd6..a4bb4dadb5f39 100644
> --- a/drivers/hwmon/hp-wmi-sensors.c
> +++ b/drivers/hwmon/hp-wmi-sensors.c
> @@ -631,8 +631,14 @@ static int check_numeric_sensor_wobj(const union acpi_object *wobj,
>  	for (i = 0; i < elem_count && prop <= last_prop; i++, prop++) {
>  		type = elements[i].type;
>  		valid_type = hp_wmi_property_map[prop];
> -		if (type != valid_type)
> +		if (type != valid_type) {
> +			if (type == ACPI_TYPE_BUFFER &&
> +			    valid_type == ACPI_TYPE_STRING &&
> +			    is_raw_wmi_string(elements[i].buffer.pointer,
> +					      elements[i].buffer.length))
> +				continue;

[Severity: High]
Does this continue statement inadvertently bypass the switch (prop) block
that follows it?

The switch (prop) block is required to advance the loop index i when
consuming the flattened PossibleStates array, and to adjust the prop variable
for property reordering.

By skipping the switch block, the loop validation could become desynchronized
from the actual ACPI elements. 

If a malformed or maliciously crafted WMI object maps an ACPI_TYPE_INTEGER
element to a string property during validation, could this desynchronization
cause populate_numeric_sensor_from_wobj() to process the integer as a string?

This would result in the integer value aliasing as a string pointer in
extract_acpi_value():

    hp_wmi_strdup(dev, strim(element->string.pointer));

Could this lead to an arbitrary pointer dereference and kernel crash when
parsing untrusted firmware data?

>  			return -EINVAL;
> +		}
>  
>  		switch (prop) {
>  		case HP_WMI_PROPERTY_OPERATIONAL_STATUS:

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260916002907.161210-1-meatuni001@gmail.com?part=1

      reply	other threads:[~2026-09-16  0:38 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16  0:29 [PATCH] hwmon: (hp-wmi-sensors) Accept raw WMI strings in numeric sensor properties Muhammad Bilal
2026-09-16  0:38 ` sashiko-bot [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=20260916003854.B65751F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=meatuni001@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.