From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Kang Chen <k.chen@smail.nju.edu.cn>
Cc: "Matteo Martelli" <matteomartelli3@gmail.com>,
"Jonathan Cameron" <jic23@kernel.org>,
"David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Victor Duicu" <victor.duicu@microchip.com>,
linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: adc: pac1921: validate the ACPI description
Date: Tue, 3 Nov 2026 13:52:25 +0200 [thread overview]
Message-ID: <aunK-dEwsK-X_lpr@ashevche-desk.local> (raw)
In-Reply-To: <20261103114115.74662-1-k.chen@smail.nju.edu.cn>
On Tue, Nov 03, 2026 at 07:41:15PM +0800, Kang Chen wrote:
> pac1921_match_acpi_device() reads elements[0] of both _DSM replies
> without checking the top-level object type, the package count, or the
> element type. An empty package makes elements[0] an out-of-bounds
> read. A string reply to the shunt query, or an integer reply to the
> label query, makes the driver interpret unrelated union members; for
> the label query this can pass a firmware-chosen pointer to
> devm_kstrdup().
>
> Require a package with at least one element of the expected type before
> reading it. Also reject a shunt value that does not fit in the int
> range checked by the driver before it is truncated to u32.
Check mailing list for potential prior work.
...
> + if (status->type != ACPI_TYPE_PACKAGE || status->package.count < 1 ||
What's wrong with _typed() variant of acpi_evaluate_dsm()?
> + status->package.elements[0].type != ACPI_TYPE_INTEGER) {
> + ACPI_FREE(status);
> + return dev_err_probe(dev, -EINVAL,
> + "Invalid shunt value from ACPI table\n");
> + }
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2026-11-03 11:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 11:41 Kang Chen
2026-11-03 11:52 ` Andy Shevchenko [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=aunK-dEwsK-X_lpr@ashevche-desk.local \
--to=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=jic23@kernel.org \
--cc=k.chen@smail.nju.edu.cn \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matteomartelli3@gmail.com \
--cc=nuno.sa@analog.com \
--cc=victor.duicu@microchip.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
all inboxes | Powered by JetHome®