From: sashiko-bot@kernel.org
To: "Eliav Farber" <farbere@amazon.com>
Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org
Subject: Re: [PATCH v5 05/13] gpio: adp5585: use devm_blocking_notifier_chain_register()
Date: Sun, 16 Aug 2026 06:14:59 +0000 [thread overview]
Message-ID: <20260816061459.D33B81F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260816060648.4030-6-farbere@amazon.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] The device-managed event notifier is registered before the gpiochip is added, leading to a Use-After-Free of the IRQ domain during device teardown.
--
--- Patch [5]: [PATCH v5 05/13] gpio: adp5585: use devm_blocking_notifier_chain_register() ---
commit c5fe212287473e8e21c8d2bae802d7b8fa665fcd
Author: Eliav Farber <farbere@amazon.com>
gpio: adp5585: use devm_blocking_notifier_chain_register()
This commit replaces the manual registration of a blocking notifier and
its associated devm_add_action_or_reset() cleanup with the new
devm_blocking_notifier_chain_register() helper.
> diff --git a/drivers/gpio/gpio-adp5585.c b/drivers/gpio/gpio-adp5585.c
> index 6f10fc6460080..7c04a7e86c8f8 100644
> --- a/drivers/gpio/gpio-adp5585.c
> +++ b/drivers/gpio/gpio-adp5585.c
[ ... ]
> @@ -450,13 +440,9 @@ static int adp5585_gpio_probe(struct platform_device *pdev)
> girq->threaded = true;
>
> adp5585_gpio->nb.notifier_call = adp5585_gpio_key_event;
> - ret = blocking_notifier_chain_register(&adp5585->event_notifier,
> - &adp5585_gpio->nb);
> - if (ret)
> - return ret;
> -
> - ret = devm_add_action_or_reset(dev, adp5585_gpio_unreg_notifier,
> - adp5585_gpio);
> + ret = devm_blocking_notifier_chain_register(dev,
> + &adp5585->event_notifier,
> + &adp5585_gpio->nb);
[Severity: High]
This is a pre-existing issue, but does this devres registration order
leave a use-after-free window during device unbind?
Because devm_blocking_notifier_chain_register() is called before
devm_gpiochip_add_data() (which happens later in adp5585_gpio_probe),
devres will destroy the gpiochip and its IRQ domain before unregistering
this notifier during device teardown.
If the user unbinds the adp5585-gpio child device via sysfs while the
parent device remains bound, and a hardware interrupt fires on the
parent device during this teardown window, the parent's IRQ handler
executes adp5585_gpio_key_event(). This dereferences the already freed
irq.domain pointer:
adp5585_gpio_key_event() {
...
irq = irq_find_mapping(adp5585_gpio->gpio_chip.irq.domain, off);
...
}
> if (ret)
> return ret;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260816060648.4030-1-farbere@amazon.com?part=5
next prev parent reply other threads:[~2026-08-16 6:15 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-16 6:05 [PATCH v5 00/13] notifier: add device-managed registration APIs and convert drivers Eliav Farber
2026-08-16 6:06 ` [PATCH v5 01/13] notifier: add device-managed registration APIs Eliav Farber
2026-08-16 6:19 ` sashiko-bot
2026-08-16 7:00 ` Uwe Kleine-König
2026-08-16 7:04 ` Uwe Kleine-König
2026-08-16 6:06 ` [PATCH v5 02/13] pwm: iqs620a: use devm_blocking_notifier_chain_register() Eliav Farber
2026-08-16 6:06 ` [PATCH v5 03/13] iio: light: iqs621-als: " Eliav Farber
2026-08-16 6:06 ` [PATCH v5 04/13] iio: position: iqs624: " Eliav Farber
2026-08-16 6:06 ` [PATCH v5 05/13] gpio: adp5585: " Eliav Farber
2026-08-16 6:14 ` sashiko-bot [this message]
2026-08-16 6:06 ` [PATCH v5 06/13] platform/x86: bitland-mifs-wmi: " Eliav Farber
2026-08-16 6:06 ` [PATCH v5 07/13] Input: adp5585: " Eliav Farber
2026-08-16 6:14 ` sashiko-bot
2026-08-16 6:06 ` [PATCH v5 08/13] ACPI: APEI: GHES: remove unused ghes_{,un}register_vendor_record_notifier() Eliav Farber
2026-08-16 6:06 ` [PATCH v5 09/13] ACPI: APEI: GHES: use devm_blocking_notifier_chain_register() Eliav Farber
2026-08-16 6:06 ` [PATCH v5 10/13] platform/x86: uniwill-wmi: " Eliav Farber
2026-08-16 6:06 ` [PATCH v5 11/13] gpio: eic-sprd: use devm_atomic_notifier_chain_register() Eliav Farber
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=20260816061459.D33B81F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=farbere@amazon.com \
--cc=linux-input@vger.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