From: sashiko-bot@kernel.org
To: xiaopeitux@foxmail.com
Cc: linux-hwmon@vger.kernel.org
Subject: Re: [PATCH v3 4/4] hwmon: (gpd-fan): fix race condition between device removal and sysfs access
Date: Mon, 08 Jun 2026 01:47:40 +0000 [thread overview]
Message-ID: <20260608014741.5011C1F00893@smtp.kernel.org> (raw)
In-Reply-To: <tencent_A052CD0BE2646D6ED4152D429F1B9A4A1E05@qq.com>
> From: Pei Xiao <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.1780880972.git.xiaopei01@kylinos.cn?part=4
prev parent reply other threads:[~2026-06-08 1:47 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1780880972.git.xiaopei01@kylinos.cn>
2026-06-08 1:40 ` [PATCH v3 1/4] hwmon: (gpd-fan): drop global driver data and use per-device allocation xiaopeitux
2026-06-08 1:52 ` sashiko-bot
2026-06-09 13:04 ` Guenter Roeck
2026-06-10 1:30 ` Pei Xiao
2026-06-09 15:46 ` Cryolitia PukNgae
2026-06-10 1:36 ` Pei Xiao
2026-06-08 1:40 ` [PATCH v3 2/4] hwmon: (gpd-fan): Initialize EC before registering hwmon device xiaopeitux
2026-06-08 1:53 ` sashiko-bot
2026-06-08 13:01 ` Guenter Roeck
2026-06-08 1:40 ` [PATCH v3 3/4] hwmon: (gpd-fan): upgrade log level from warn to err for platform device creation failure xiaopeitux
2026-06-08 1:48 ` sashiko-bot
2026-06-08 1:40 ` [PATCH v3 4/4] hwmon: (gpd-fan): fix race condition between device removal and sysfs access xiaopeitux
2026-06-08 1:47 ` 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=20260608014741.5011C1F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=xiaopeitux@foxmail.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