All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pei Xiao" <xiaopei01@kylinos.cn>
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v4 4/4] hwmon: (gpd-fan): fix race condition between device removal and sysfs access
Date: Wed, 10 Jun 2026 01:59:26 +0000	[thread overview]
Message-ID: <20260610015926.8A2C61F00893@smtp.kernel.org> (raw)
In-Reply-To: <4400828422cf3a88adad4db224d9efccdb1049d2.1781055639.git.xiaopei01@kylinos.cn>

> Replace the manual gpd_fan_remove() callback with a devres-managed
> action using devm_add_action_or_reset(). The original remove hook
> resets the fan to AUTOMATIC mode, but the hwmon sysfs interface
> (registered with devm_hwmon_device_register_with_info()) remains
> active until after the remove callback completes. This creates a
> race window where a concurrent userspace sysfs access can interleave
> with the EC I/O sequence, potentially corrupting EC registers.
> 
> Using devm_add_action_or_reset() registers the reset function as a
> devres action. Due to the LIFO release order of devres, the hwmon
> device is unregistered (sysfs removed) before the reset action
> executes, eliminating the race condition.
> 
> Fixes: 0ab88e239439 ("hwmon: add GPD devices sensor driver")
> Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1781055639.git.xiaopei01@kylinos.cn?part=4


      reply	other threads:[~2026-06-10  1:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  1:49 [PATCH v4 0/4] some cleanup and fix in gpd-fan Pei Xiao
2026-06-10  1:49 ` [PATCH v4 1/4] hwmon: (gpd-fan): drop global driver data and use per-device allocation Pei Xiao
2026-06-10  2:02   ` sashiko-bot
2026-06-10  1:49 ` [PATCH v4 2/4] hwmon: (gpd-fan): Initialize EC before registering hwmon device Pei Xiao
2026-06-10  2:02   ` sashiko-bot
2026-06-10  1:49 ` [PATCH v4 3/4] hwmon: (gpd-fan): upgrade log level from warn to err for platform device creation failure Pei Xiao
2026-06-10  1:54   ` sashiko-bot
2026-06-10  1:49 ` [PATCH v4 4/4] hwmon: (gpd-fan): fix race condition between device removal and sysfs access Pei Xiao
2026-06-10  1:59   ` 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=20260610015926.8A2C61F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=xiaopei01@kylinos.cn \
    /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.