From: sashiko-bot@kernel.org
To: "Roman Vivchar" <rva333@protonmail.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH 2/3] soc: mediatek: pwrap: use correct log level
Date: Tue, 14 Jul 2026 12:53:01 +0000 [thread overview]
Message-ID: <20260714125302.4776C1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260714-6572-pwrap-v1-2-d8e5a39cf7ef@protonmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Child devices created by `of_platform_populate()` are leaked upon probe failure or driver unbind, leading to a Use-After-Free.
--
--- Patch [2]: [PATCH 2/3] soc: mediatek: pwrap: use correct log level ---
commit 9e7d63641cf243186ed10eee942d5eeb9f4b6345
Author: Roman Vivchar <rva333@protonmail.com>
soc: mediatek: pwrap: use correct log level
This commit updates error handling in the mediatek pwrap driver to use
dev_err_probe instead of dev_dbg for error branches. It also simplifies
the returns by utilizing dev_err_probe.
> diff --git a/drivers/soc/mediatek/mtk-pmic-wrap.c b/drivers/soc/mediatek/mtk-pmic-wrap.c
> index 0bcd858263755..a4b10b0a97cbb 100644
> --- a/drivers/soc/mediatek/mtk-pmic-wrap.c
> +++ b/drivers/soc/mediatek/mtk-pmic-wrap.c
[ ... ]
> @@ -2593,11 +2584,9 @@ static int pwrap_probe(struct platform_device *pdev)
> return PTR_ERR(wrp->regmap);
>
> ret = of_platform_populate(np, NULL, NULL, wrp->dev);
> - if (ret) {
> - dev_dbg(wrp->dev, "failed to create child devices at %pOF\n",
> - np);
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(wrp->dev, ret,
> + "failed to create child devices at %pOF\n", np);
[Severity: High]
This is a pre-existing issue, but does this missing cleanup for
of_platform_populate() leave child devices registered if this fails
halfway through, or during driver unbind?
If a user unbinds the driver via sysfs, devres will automatically free
the parent driver's resources, including wrp->regmap. Since there is no
remove callback to call of_platform_depopulate(), the child devices
remain active. When these active child drivers subsequently attempt to
use their parent's freed regmap, could this result in a use-after-free?
Would it be safer to use devm_of_platform_populate() here instead to
ensure proper cleanup?
> return 0;
> }
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260714-6572-pwrap-v1-0-d8e5a39cf7ef@protonmail.com?part=2
next prev parent reply other threads:[~2026-07-14 12:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-14 12:42 [PATCH 0/3] soc: mediatek: pwrap: mt6572 support + log level fixes Roman Vivchar via B4 Relay
2026-07-14 12:42 ` [PATCH 1/3] dt-bindings: soc: mediatek: pwrap: add mt6572 Roman Vivchar via B4 Relay
2026-07-14 12:42 ` [PATCH 2/3] soc: mediatek: pwrap: use correct log level Roman Vivchar via B4 Relay
2026-07-14 12:53 ` sashiko-bot [this message]
2026-07-14 12:42 ` [PATCH 3/3] soc: mediatek: pwrap: add mt6572 support Roman Vivchar via B4 Relay
2026-07-14 13:24 ` 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=20260714125302.4776C1F00A3A@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=rva333@protonmail.com \
--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