[PATCH v4 0/4] gpio: shared: replace platform lookup with dummy software nodes

From: Bartosz Golaszewski

Date: Wed Oct 14 2026 - 05:49:08 EST


Abel reported to me a crash on Eliza linked to fwnode GPIO lookup for
shared GPIOs. Turns out we don't support no-device, fwnode-based lookup
for shared GPIOs. In fact: we trigger a NULL-pointer deference.

Making it work requires a more serious rework. This is what patch 4/4
does with 3/4 introducing a preparatory improvement.

The second patch fixes the NULL-pointer dereference in favor of
gracefully returning an error. The first patch fixes another problem the
clanker found during review.

Tested that the issue no longer happens and that fwnode-based sharing of
GPIOs works on Qualcomm Eliza.

Patches 1-2 should go into v7.3 and stable. Patches 3-4 are v7.4
material.

Sashiko pointed out two more issues under v2 but they're false positives.

Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>
---
Changes in v4:
- Fix arguments passed to ida_free() in error path
- Fix memory leak in error path
- Link to v3: https://patch.msgid.link/20261013-gpio-shared-fwnode-lookup-v3-0-4553c1a7d80f@xxxxxxxxxxxxxxxx

Changes in v3:
- Move struct auxiliary_device out of struct gpio_shared_ref
- Link to v2: https://patch.msgid.link/20261001-gpio-shared-fwnode-lookup-v2-0-9a40681713cc@xxxxxxxxxxxxxxxx

Changes in v2:
- Rework the shared GPIO management to replace platform lookup with
software nodes associated with proxy GPIO controllers
- Link to v1: https://patch.msgid.link/20260929-gpio-shared-fwnode-lookup-v1-0-57d54811de1a@xxxxxxxxxxxxxxxx

---
Bartosz Golaszewski (4):
gpio: shared: fix use-after-free bug when adding shared proxies
gpio: shared: gracefully handle no-device lookup of shared GPIOs
gpio: shared: detach the proxy device from struct gpio_shared_ref
gpio: shared: convert to using software nodes for GPIO shared proxy lookup

drivers/gpio/gpiolib-shared.c | 159 ++++++++++++++++++++++--------------------
drivers/gpio/gpiolib-shared.h | 15 ++--
drivers/gpio/gpiolib.c | 20 +-----
3 files changed, 94 insertions(+), 100 deletions(-)
---
base-commit: 1fffefb00cc0b0da1f2ae24e3d33364530ea6515
change-id: 20260929-gpio-shared-fwnode-lookup-e866faeb5bde

Best regards,
--
Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>