From: "Marco Scardovi (scardracs)" <mscardovi95@gmail.com>
To: andriy.shevchenko@linux.intel.com
Cc: brgl@kernel.org, linusw@kernel.org, linux-acpi@vger.kernel.org,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
mika.westerberg@linux.intel.com, mscardovi95@gmail.com,
westeri@kernel.org
Subject: [PATCH v3 0/2] gpiolib: acpi: Fix bounds-checking and connection leak
Date: Wed, 20 May 2026 09:45:45 +0200 [thread overview]
Message-ID: <20260520074955.55443-1-mscardovi95@gmail.com> (raw)
In-Reply-To: <agwfEMtEctXYC1oc@ashevche-desk.local>
Hi Andy,
This new series addresses two issues in the ACPI GPIO library while trying
to address your feedbacks:
1. Adds robust bounds checking for pin resource indexing when requesting
owned descriptors and querying wakeup/interrupt pin configurations.
2. Fixes a connection/descriptor leak in the OpRegion address space
handler and handles connection rollback in a transaction-local list
to avoid wiping successfully established connections.
Please note that some of these changes were found during a personal follow up
analysis before submitting the patches to the community. They are reported
to explain why some of these fixes are made in that way instead of another.
Changes since v2:
- Fixed a global over-cleanup bug in the error path of the handler, which
incorrectly wiped the whole persistent connection list (achip->conns).
We now use a temporary local list_head (new_conns) inside the handler
to log and rollback only the connections requested during the current
transaction, and splice them into the global list only on success.
- Renamed the global connections teardown helper to
acpi_gpiochip_free_all_connections() to clearly indicate its scope.
- Fixed a potential concurrent connection duplication race in the handler
using an optimistic double-check allocation retry pattern.
- Introduced the acpi_gpiochip_find_conn() helper to reduce lookup code
duplication.
- Changed the subject prefix of Patch 2/2 to "Fixes: gpiolib: acpi: ...".
Changes since v1:
- Reworked bounds checking in acpi_gpio_adr_space_handler() to validate
that the requested pin range [pin_index, pin_index + bits] remains within
bounds of the ACPI resource pin table, returning -EINVAL instead of
silent truncation.
As always I'll wait for your precious feedbacks
Assisted-by: Antigravity:gemini-3-flash
Signed-off-by: Marco Scardovi <mscardovi95@gmail.com>
Marco Scardovi (scardracs) (2):
gpiolib: acpi: Add robust bounds-checking for GPIO pin resources
Fixes: gpiolib: acpi: resource leak in OpRegion
drivers/gpio/gpiolib-acpi-core.c | 157 ++++++++++++++++++++++++++++++---------
1 file changed, 122 insertions(+), 35 deletions(-)
--
2.54.0
next prev parent reply other threads:[~2026-05-20 7:50 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-18 7:53 [PATCH 00/12] gpiolib: acpi: Refactor, harden, and modularize ACPI GPIO support Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 01/12] gpiolib: acpi: Use snprintf() for ACPI event name formatting Marco Scardovi (scardracs)
2026-05-18 8:07 ` Andy Shevchenko
2026-05-18 7:53 ` [PATCH 02/12] gpiolib: acpi: Modernize string parsing in quirks layer Marco Scardovi (scardracs)
2026-05-18 8:11 ` Andy Shevchenko
2026-05-18 7:53 ` [PATCH 03/12] gpiolib: acpi: Add robust bounds-checking for GPIO pin resources Marco Scardovi (scardracs)
2026-05-18 10:33 ` Mika Westerberg
2026-05-19 7:00 ` [PATCH v2 0/2] gpiolib: acpi: Add bounds-checking and fix leak in OpRegion Marco Scardovi (scardracs)
2026-05-19 7:00 ` [PATCH 1/2] gpiolib: acpi: Add robust bounds-checking for GPIO pin resources Marco Scardovi (scardracs)
2026-05-19 7:25 ` Andy Shevchenko
2026-05-19 7:00 ` [PATCH 2/2] gpiolib: acpi: Fix resource leak in OpRegion cleanup path Marco Scardovi (scardracs)
2026-05-19 8:28 ` Andy Shevchenko
2026-05-20 7:45 ` Marco Scardovi (scardracs) [this message]
2026-05-20 7:45 ` [PATCH v3 1/2] gpiolib: acpi: Add robust bounds-checking for GPIO pin resources Marco Scardovi (scardracs)
2026-06-02 7:34 ` Andy Shevchenko
2026-05-20 7:45 ` [PATCH v3 2/2] Fixes: gpiolib: acpi: resource leak in OpRegion Marco Scardovi (scardracs)
2026-06-02 7:45 ` Andy Shevchenko
2026-06-02 7:47 ` [PATCH v3 0/2] gpiolib: acpi: Fix bounds-checking and connection leak Andy Shevchenko
2026-05-18 7:53 ` [PATCH 04/12] gpiolib: acpi: Fix resource leak in OpRegion cleanup path Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 05/12] gpiolib: acpi: Declare shared structures in gpiolib-acpi.h Marco Scardovi (scardracs)
2026-05-18 8:21 ` Andy Shevchenko
2026-05-18 7:53 ` [PATCH 06/12] gpiolib: acpi: Expose core GPIO resource and OpRegion helpers Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 07/12] gpiolib: acpi: Add dedicated Operation Region module Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 08/12] gpiolib: acpi: Divert OpRegion registration callbacks from core Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 09/12] gpiolib: acpi: Remove unused static address space emulation " Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 10/12] gpiolib: acpi: Declare shared event helpers in gpiolib-acpi.h Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 11/12] gpiolib: acpi: Add dedicated ACPI GPIO events module Marco Scardovi (scardracs)
2026-05-18 7:53 ` [PATCH 12/12] gpiolib: acpi: Decouple Event and Interrupt handling from core Marco Scardovi (scardracs)
2026-05-18 8:19 ` [PATCH 00/12] gpiolib: acpi: Refactor, harden, and modularize ACPI GPIO support Andy Shevchenko
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=20260520074955.55443-1-mscardovi95@gmail.com \
--to=mscardovi95@gmail.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=brgl@kernel.org \
--cc=linusw@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=westeri@kernel.org \
/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