From: Vincent Jardin <vjardin@free.fr>
To: sashiko-reviews@lists.linux.dev
Cc: conor+dt@kernel.org, robh@kernel.org,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v2 3/3] hwmon: pmbus: add MPQ8646 driver
Date: Thu, 23 Jul 2026 22:23:02 +0200 [thread overview]
Message-ID: <amJ4JvsnoQNIaTaD@L30177.local> (raw)
In-Reply-To: <20260723160717.8AEA61F000E9@smtp.kernel.org>
Hi Mr. Bot,
> [Severity: High]
> Is it safe to pass stack-allocated buffers to i2c_transfer() here?
> If the underlying I2C adapter driver uses DMA for transfers, dma_map_single()
> will attempt to map these stack addresses. On systems with virtually mapped
> stacks, this violates DMA mapping rules and could lead to memory corruption.
It was already argued into v1, no change. See v1's answer to your analysis.
> [Severity: Low]
> Does this hook effectively intercept page writes?
> The write_byte callback is used for the PMBus Send Byte protocol, but PMBus
> page changes use the Write Byte Data protocol via i2c_smbus_write_byte_data().
> It appears page changes will completely bypass this check.
You have a point, I'll send a v3
> [Severity: Medium]
> Does this sequence bypass the PMBus core serialization?
> By using the private mps_lock instead of pmbus_lock(), the PMBus core could
> concurrently issue sysfs reads during these NVMEM reads.
I'll propose something for the v3.
> [Severity: Low]
> Could concurrent debugfs writes cause torn diagnostic state here?
> The last_probe_rc and last_probe_data variables are updated sequentially
> without synchronization. This might expose mismatched values to userspace
> readers in mpq8646_dbg_last_probe_show().
Yes !, v3
> [Severity: Low]
> Could this direct hardware page write desynchronize the PMBus core page cache?
> Since the core's software page cache is not updated, and the driver declares
> pages = 1, the core assumes page switches are unnecessary and will not restore
> it. This could cause sysfs telemetry to return incorrect data until reload.
OK, I did revisit it. Because the chip is for .pages = 1, the core never re-writes
PMBUS_PAGE, so a raw write of a non-zero page via this debugfs hook would
fail with the hardware on that page and the core would keep reading it as page 0
until a reload
So v3 will remove probe_page_write entirely (same rationale as dropping the
now-useless PMBUS_PAGE swallow in write_byte).
> [Severity: Medium]
> Does this multi-step unlock sequence bypass pmbus_lock()?
> The PMBus core could issue interleaved sysfs reads while the chip is unlocked
> or busy writing to NVM, potentially leading to I2C NACKs.
yep, ok.
The v3 will wrap the whole sequence with pmbus_lock()/pmbus_unlock(),
nested outside the existing mps_lock.
> [Severity: Medium]
> How is the worker restarted if a user writes to this debugfs file after
> disabling polling?
> Because the variable is exported directly without a setter function, writing
> a non-zero value updates the integer but fails to call schedule_delayed_work()
> to re-arm the worker.
right, the raw debugfs_create_u32() export cannot re-arm the worker.
I'll check it.
> [Severity: Medium]
> Does this direct hardware telemetry access also bypass pmbus_lock()?
> Without the core lock, concurrent accesses from this background worker
> could conflict with other sysfs polling.
Confirmed. The next v3 will wraps the worker's STATUS_WORD read within
pmbus_lock()/pmbus_unlock(), so it shall no longer race the
core's sysfs telemetry accesses.
> --
> Sashiko AI review · https://sashiko.dev/#/patchset/20260723-mpq8646_v0-v2-0-3c4cb71f23c0@free.fr?part=3
prev parent reply other threads:[~2026-07-23 20:23 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 15:46 [PATCH v2 0/3] hwmon: pmbus: add MPS MPQ8646 support Vincent Jardin via B4 Relay
2026-07-23 15:46 ` [PATCH v2 1/3] hwmon: pmbus: event notification with alarms Vincent Jardin via B4 Relay
2026-07-23 15:52 ` sashiko-bot
2026-07-23 15:46 ` [PATCH v2 2/3] dt-bindings: hwmon: pmbus: add MPS MPQ8646 binding Vincent Jardin via B4 Relay
2026-07-23 15:53 ` sashiko-bot
2026-07-23 15:46 ` [PATCH v2 3/3] hwmon: pmbus: add MPQ8646 driver Vincent Jardin via B4 Relay
2026-07-23 16:07 ` sashiko-bot
2026-07-23 20:23 ` Vincent Jardin [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=amJ4JvsnoQNIaTaD@L30177.local \
--to=vjardin@free.fr \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=robh@kernel.org \
--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