* [PATCH] hwmon: (pmbus/core) Avoid race condition during probe
@ 2026-08-03 19:30 Guenter Roeck
2026-08-03 19:40 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2026-08-03 19:30 UTC (permalink / raw)
To: Hardware Monitoring; +Cc: Guenter Roeck
pmbus_write_smbalert_mask() is not guarded, which can cause race conditions
with concurrent sysfs attribute accesses.
Similar, PMBus accesses in pmbus_init_debugfs() are not guarded, also
resulting in potential race conditions.
Add guards to both functions to prevent the races.
Fixes: 221819ca4c36e ("hwmon: (pmbus/core) Add interrupt support")
Fixes: 1e069dfd96dfe ("hwmon: (pmbus) Add debugfs for status registers")
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
drivers/hwmon/pmbus/pmbus_core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index ba3e9e9fc8bc..6991c7f8d125 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -3448,6 +3448,8 @@ static int pmbus_write_smbalert_mask(struct i2c_client *client, u8 page, u8 reg,
{
int ret;
+ guard(pmbus_lock)(client);
+
ret = _pmbus_write_word_data(client, page, PMBUS_SMBALERT_MASK, reg | (val << 8));
/*
@@ -3700,6 +3702,8 @@ static void pmbus_init_debugfs(struct i2c_client *client,
if (!entries)
return;
+ guard(pmbus_lock)(client);
+
/*
* Add device-specific entries.
* Please note that the PMBUS standard allows all registers to be
--
2.45.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] hwmon: (pmbus/core) Avoid race condition during probe
2026-08-03 19:30 [PATCH] hwmon: (pmbus/core) Avoid race condition during probe Guenter Roeck
@ 2026-08-03 19:40 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-08-03 19:40 UTC (permalink / raw)
To: Guenter Roeck; +Cc: linux-hwmon
> pmbus_write_smbalert_mask() is not guarded, which can cause race conditions
> with concurrent sysfs attribute accesses.
>
> Similar, PMBus accesses in pmbus_init_debugfs() are not guarded, also
> resulting in potential race conditions.
>
> Add guards to both functions to prevent the races.
>
> Fixes: 221819ca4c36e ("hwmon: (pmbus/core) Add interrupt support")
> Fixes: 1e069dfd96dfe ("hwmon: (pmbus) Add debugfs for status registers")
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260803193033.2285332-1-linux@roeck-us.net?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-08-03 19:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03 19:30 [PATCH] hwmon: (pmbus/core) Avoid race condition during probe Guenter Roeck
2026-08-03 19:40 ` sashiko-bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox