From: "Nuno Sá" <nuno.sa@analog.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Hardware Monitoring <linux-hwmon@vger.kernel.org>
Subject: Re: [PATCH] hwmon: (pmbus) Validate number of phases per page
Date: Mon, 14 Sep 2026 13:21:16 +0100 [thread overview]
Message-ID: <aqfmipEHnoQ24vIZ@nsa> (raw)
In-Reply-To: <20260912145038.2411447-1-linux@roeck-us.net>
On Sat, Sep 12, 2026 at 07:50:38AM -0700, Guenter Roeck wrote:
> It is possible for a PMBus driver to configure a phase count larger than
> the PMBUS_PHASES limit and cause an out-of-bounds read.
>
> Add a bounds check for info->phases against PMBUS_PHASES in the core API
> to prevent the potential out-of-bounds read.
>
> Cc: Nuno Sá <nuno.sa@analog.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
Looks like sashiko comment does not apply with the patch on the max20826
series. Hence:
Reviewed-by: Nuno Sá <nuno.sa@analog.com>
> drivers/hwmon/pmbus/pmbus_core.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 5104fd29307b..d69f1bde1795 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2982,6 +2982,11 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
> }
>
> for (page = 0; page < info->pages; page++) {
> + if (info->phases[page] > PMBUS_PHASES) {
> + dev_err(dev, "Bad number of PMBus phases for page %d: %d\n",
> + page, info->phases[page]);
> + return -ENODEV;
> + }
> ret = pmbus_identify_common(client, data, page);
> if (ret < 0) {
> dev_err(dev, "Failed to identify chip capabilities\n");
> --
> 2.45.2
>
prev parent reply other threads:[~2026-09-14 12:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-12 14:50 [PATCH] hwmon: (pmbus) Validate number of phases per page Guenter Roeck
2026-09-12 15:07 ` sashiko-bot
2026-09-14 12:21 ` Nuno Sá [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=aqfmipEHnoQ24vIZ@nsa \
--to=nuno.sa@analog.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux@roeck-us.net \
/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.