Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Luca Leonardo Scorcia" <l.scorcia@gmail.com>
Cc: devicetree@vger.kernel.org, dmitry.torokhov@gmail.com,
	mfd@lists.linux.dev, robh@kernel.org,
	linux-input@vger.kernel.org, lee@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v10 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices
Date: Wed, 02 Sep 2026 20:10:51 +0000	[thread overview]
Message-ID: <20260902201052.006B61F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260902193351.185771-5-l.scorcia@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] Missing .remove callback leads to PM notifier use-after-free and IRQ domain memory leak on module unload.
--

commit 6a7d774cdf490c33501d839d753ee001e1219166
Author: Luca Leonardo Scorcia <l.scorcia@gmail.com>

mfd: mt6397: Use MFD_CELL_* to describe sub-devices

Use the MFD_CELL_* macros to describe sub-devices. No functional changes.

> diff --git a/drivers/mfd/mt6397-core.c b/drivers/mfd/mt6397-core.c
> index 9ec9519965887..3e08179002fad 100644
> --- a/drivers/mfd/mt6397-core.c
> +++ b/drivers/mfd/mt6397-core.c
> @@ -124,165 +124,92 @@ static const struct resource mt6323_pwrc_resources[] = {

[ ... ]

>  static const struct mfd_cell mt6397_devs[] = {
> -	{
> -		.name = "mt6397-rtc",
> -		.num_resources = ARRAY_SIZE(mt6397_rtc_resources),
> -		.resources = mt6397_rtc_resources,
> -		.of_compatible = "mediatek,mt6397-rtc",
> -	}, {
> -		.name = "mt6397-regulator",
> -		.of_compatible = "mediatek,mt6397-regulator",
> -	}, {

[ ... ]

> +	MFD_CELL_OF("mt6397-keys", mt6397_keys_resources, NULL, 0, 0,
> +		    "mediatek,mt6397-keys"),
>  };
>  
>  struct chip_data {

[Severity: High]
This is a pre-existing issue, but looking at the platform driver definition:

drivers/mfd/mt6397-core.c:
    static struct platform_driver mt6397_driver = {
        .probe = mt6397_probe,
        .driver = {
            .name = "mt6397",
            ...
        },
        ...
    };

Could the absence of a .remove callback lead to a PM notifier use-after-free
and IRQ domain memory leak on module unload?

During probe, mt6397_probe() calls mt6397_irq_init() which registers a PM
notifier with register_pm_notifier(&chip->pm_nb) and creates an IRQ domain
with irq_domain_create_linear().

Because the mt6397_driver struct lacks a .remove callback, unbinding the
driver (via module unload or sysfs) triggers standard devm teardown, freeing
the chip structure that was allocated via devm_kzalloc().

Doesn't this leave the kernel's PM notifier chain with a dangling pointer
to the freed chip->pm_nb, causing a crash on the next suspend/resume cycle,
and leave the IRQ domain unremoved?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260902193351.185771-1-l.scorcia@gmail.com?part=4

  reply	other threads:[~2026-09-02 20:10 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-02 19:25 [PATCH v10 0/9] Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-09-02 19:25 ` [PATCH v10 1/9] dt-bindings: mfd: mt6397: Add " Luca Leonardo Scorcia
2026-09-02 19:41   ` sashiko-bot
2026-09-03  8:24   ` Krzysztof Kozlowski
2026-09-02 19:25 ` [PATCH v10 2/9] dt-bindings: input: mtk-pmic-keys: Add MT6392 PMIC keys Luca Leonardo Scorcia
2026-09-02 19:50   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 3/9] regulator: dt-bindings: Add MediaTek MT6392 PMIC Luca Leonardo Scorcia
2026-09-02 20:00   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 4/9] mfd: mt6397: Use MFD_CELL_* to describe sub-devices Luca Leonardo Scorcia
2026-09-02 20:10   ` sashiko-bot [this message]
2026-09-02 19:25 ` [PATCH v10 5/9] mfd: mt6397: Add support for MT6392 PMIC Luca Leonardo Scorcia
2026-09-02 20:24   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 6/9] input: keyboard: mtk-pmic-keys: Add MT6392 support Luca Leonardo Scorcia
2026-09-02 20:37   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 7/9] pinctrl: mediatek: mt6397: Add MediaTek MT6392 Luca Leonardo Scorcia
2026-09-02 20:50   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 8/9] regulator: Add MediaTek MT6392 regulator Luca Leonardo Scorcia
2026-09-02 20:58   ` sashiko-bot
2026-09-02 19:25 ` [PATCH v10 9/9] arm64: dts: mediatek: Add MediaTek MT6392 PMIC dtsi Luca Leonardo Scorcia
2026-09-02 21:05   ` 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=20260902201052.006B61F00A3A@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