From: sashiko-bot@kernel.org
To: "Luca Leonardo Scorcia" <l.scorcia@gmail.com>
Cc: lee@kernel.org, robh@kernel.org, linux-input@vger.kernel.org,
conor+dt@kernel.org, mfd@lists.linux.dev,
devicetree@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH v9 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices
Date: Thu, 20 Aug 2026 12:47:46 +0000 [thread overview]
Message-ID: <20260820124747.756411F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260820122242.120039-5-l.scorcia@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] This problem wasn't introduced by this patch, but missing PM notifier cleanup in the probe error path and lack of a .remove hook leads to a use-after-free on suspend/resume or driver unbind.
--
--- Patch [4]: [PATCH v9 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices ---
commit 0c24567f61112fe4c7555b7e30256529aae1d5d6
Author: Luca Leonardo Scorcia <l.scorcia@gmail.com>
mfd: mt6397: Use MFD_CELL_* to describe sub-devices
This commit updates the mfd_cell arrays for various MediaTek MT6397 family
PMICs to use the standard MFD_CELL_OF() and MFD_CELL_NAME() macros instead of
manual field initialization. No functional changes are intended.
> diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
> index 1bdacda9a933f..ccd97d66d7f1c 100644
> --- a/drivers/mfd/mt6397-core.c
> +++ b/drivers/mfd/mt6397-core.c
[ ... ]
> @@ -272,11 +202,14 @@ static const struct mfd_cell mt6397_devs[] = {
> - }, {
> - .name = "mt6397-keys",
> - .num_resources = ARRAY_SIZE(mt6397_keys_resources),
> - .resources = mt6397_keys_resources,
> - .of_compatible = "mediatek,mt6397-keys"
> - }
> + MFD_CELL_OF("mt6397-keys", mt6397_keys_resources, NULL, 0, 0,
> + "mediatek,mt6397-keys"),
> };
[Severity: High]
This isn't a bug introduced by this patch, but I noticed a potential
use-after-free issue in the driver's error handling and unbind paths.
In drivers/mfd/mt6397-irq.c:mt6397_irq_init(), the PM notifier is registered
globally with register_pm_notifier() but without devres management.
In drivers/mfd/mt6397-core.c:mt6397_probe(), if devm_mfd_add_devices() fails,
the error path removes the IRQ domain but fails to unregister the PM notifier
before returning.
Furthermore, mt6397_driver lacks a .remove hook entirely. Unbinding the driver
via sysfs completely bypasses cleanup for both the PM notifier and the IRQ
domain.
In both the probe failure and driver unbind scenarios, the devres subsystem
subsequently frees the memory containing the notifier block and IRQ domain host
data. When the system later enters suspend or resume, pm_notifier_call_chain()
will iterate over the freed memory.
Could this lead to a kernel panic? Should a .remove hook be added and the
probe error path updated to ensure the PM notifier is properly unregistered?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260820122242.120039-1-l.scorcia@gmail.com?part=4
next prev parent reply other threads:[~2026-08-20 12:47 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-20 12:19 [PATCH RESEND v9 0/9] Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-08-20 12:19 ` [PATCH v9 1/9] dt-bindings: mfd: mt6397: Add " Luca Leonardo Scorcia
2026-08-20 12:40 ` sashiko-bot
2026-08-20 16:23 ` Luca Leonardo Scorcia
2026-08-20 12:20 ` [PATCH v9 2/9] dt-bindings: input: mtk-pmic-keys: Add MT6392 PMIC keys Luca Leonardo Scorcia
2026-08-20 12:44 ` sashiko-bot
2026-08-20 12:20 ` [PATCH v9 3/9] regulator: dt-bindings: Add MediaTek MT6392 PMIC Luca Leonardo Scorcia
2026-08-20 12:39 ` sashiko-bot
2026-08-20 12:20 ` [PATCH v9 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices Luca Leonardo Scorcia
2026-08-20 12:47 ` sashiko-bot [this message]
2026-08-20 12:20 ` [PATCH v9 5/9] mfd: mt6397: Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-08-20 12:49 ` sashiko-bot
2026-08-20 12:20 ` [PATCH v9 6/9] input: keyboard: mtk-pmic-keys: Add MT6392 support Luca Leonardo Scorcia
2026-08-20 12:43 ` sashiko-bot
2026-08-20 12:20 ` [PATCH v9 7/9] pinctrl: mediatek: mt6397: Add MediaTek MT6392 Luca Leonardo Scorcia
2026-08-20 12:51 ` sashiko-bot
2026-08-20 12:20 ` [PATCH v9 8/9] regulator: Add MediaTek MT6392 regulator Luca Leonardo Scorcia
2026-08-20 12:40 ` sashiko-bot
2026-08-20 12:20 ` [PATCH v9 9/9] arm64: dts: mediatek: Add MediaTek MT6392 PMIC dtsi Luca Leonardo Scorcia
2026-08-20 12:58 ` sashiko-bot
-- strict thread matches above, loose matches on Subject: below --
2026-06-21 8:13 [PATCH v9 0/9] Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-06-21 8:13 ` [PATCH v9 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices Luca Leonardo Scorcia
2026-06-21 8:29 ` sashiko-bot
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=20260820124747.756411F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=l.scorcia@gmail.com \
--cc=lee@kernel.org \
--cc=linux-input@vger.kernel.org \
--cc=mfd@lists.linux.dev \
--cc=robh@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