Linux Hardware Monitor development
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Guenter Roeck" <linux@roeck-us.net>,
	"Hardware Monitoring" <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH] hwmon: (hp-wmi-sensors) Serialize alarm flag read-and-clear with state->lock
Date: Tue, 03 Nov 2026 19:22:38 +0000	[thread overview]
Message-ID: <sashiko-outbox-195910@kernel.org> (raw)
In-Reply-To: <20261103191846.3132938-1-linux@roeck-us.net>

> In hp_wmi_hwmon_read(), temperature and fan alarm flags (info->alarm)
> are evaluated and cleared without acquiring state->lock, while only the
> hwmon subsystem lock is held by the hwmon core. Meanwhile, the
> asynchronous WMI event handler hp_wmi_notify() sets info->alarm under
> state->lock. If hp_wmi_notify() sets info->alarm between the read and
> the subsequent clear in hp_wmi_hwmon_read(), the newly reported fan
> stall or critical temperature alarm is overwritten with false and
> permanently lost.
> 
> The driver-local state->lock cannot be replaced with the hwmon
> subsystem lock (hwmon_lock()):
> - When no connected hwmon-supported sensors are present (!count), the
>   driver operates in debugfs-only mode without registering a hwmon
>   device, while debugfs attributes (fungible_show()) still require
>   state->lock to serialize WMI queries and sensor state updates.
> - Even when sensors are connected, add_event_handler() must subscribe
>   to WMI events before make_chip_info() and
>   devm_hwmon_device_register_with_info() because visibility of alarm
>   and intrusion attributes depends on whether event registration
>   succeeded. As a result, hp_wmi_notify() can run before the hwmon
>   device exists during probe and after devm unregisters and frees the
>   hwmon device during removal.
> 
> Acquire state->lock in hp_wmi_hwmon_read() around reading and clearing
> info->alarm to prevent losing WMI alarm events.
> 
> Fixes: 23902f98f8d4 ("hwmon: add HP WMI Sensors driver")
> Cc: James Seo <james@equiv.tech>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261103191846.3132938-1-linux@roeck-us.net?part=1


      reply	other threads:[~2026-11-03 19:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-03 19:18 [PATCH] hwmon: (hp-wmi-sensors) Serialize alarm flag read-and-clear with state->lock Guenter Roeck
2026-11-03 19:22 ` 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=sashiko-outbox-195910@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox