From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: neil.armstrong@linaro.org, linux-amlogic@lists.infradead.org
Subject: Re: [PATCH 2/2] ASoC: meson: meson-card-utils: Drop redundant probe error messages
Date: Fri, 14 Aug 2026 09:51:19 +0000 [thread overview]
Message-ID: <20260814095120.235F21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260814094211.25151-2-phucduc.bui@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Preexisting dangling pointer dereference (Use-After-Free) and double-free in the `meson_card_reallocate_links()` error path.
--
--- Patch [2]: [PATCH 2/2] ASoC: meson: meson-card-utils: Drop redundant probe error messages ---
commit 94de42ca0b099508e39600d3d3d0d282a866cfb3
Author: bui duc phuc <phucduc.bui@gmail.com>
ASoC: meson: meson-card-utils: Drop redundant probe error messages
This commit removes redundant dev_err() calls from meson_card_probe()
since the errors are already reported deeper in the call chain.
> diff --git a/sound/soc/meson/meson-card-utils.c b/sound/soc/meson/meson-card-utils.c
> index cdb759b466ad4..48047312cf47f 100644
> --- a/sound/soc/meson/meson-card-utils.c
> +++ b/sound/soc/meson/meson-card-utils.c
[ ... ]
> @@ -289,17 +289,13 @@ int meson_card_probe(struct platform_device *pdev)
>
> ret = meson_card_parse_of_optional(&priv->card, "audio-widgets",
> snd_soc_of_parse_audio_simple_widgets);
> - if (ret) {
> - dev_err(dev, "error while parsing widgets\n");
> + if (ret)
> return ret;
> - }
>
> ret = meson_card_add_links(&priv->card);
> if (ret)
[Severity: High]
This isn't a bug introduced by this patch, but if meson_card_add_links()
fails, could it trigger a use-after-free and double-free in the error
handling path?
If meson_card_reallocate_links() fails its second krealloc() for
priv->link_data, it jumps to err_ldata and frees the links array:
sound/soc/meson/meson-card-utils.c:meson_card_reallocate_links() {
...
err_ldata:
kfree(links);
err_links:
dev_err(priv->card.dev, "failed to allocate links\n");
return -ENOMEM;
}
However, priv->card.dai_link retains its old value pointing to the freed
memory.
When the probe function receives the error, it jumps to out_err and calls
meson_card_clean_references(), which iterates over card->dai_link:
sound/soc/meson/meson-card-utils.c:meson_card_clean_references() {
...
if (card->dai_link) {
for_each_card_prelinks(card, i, link) {
...
kfree(card->dai_link);
}
This appears to dereference the freed links array and then kfree() it again.
Could priv->card.dai_link be set to NULL before returning from the
error path in meson_card_reallocate_links() to prevent this?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260814094211.25151-1-phucduc.bui@gmail.com?part=2
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2026-08-14 9:51 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-14 9:42 [PATCH 1/2] ASoC: meson: aiu: Drop redundant probe error messages phucduc.bui
2026-08-14 9:42 ` phucduc.bui
2026-08-14 9:42 ` [PATCH 2/2] ASoC: meson: meson-card-utils: " phucduc.bui
2026-08-14 9:42 ` phucduc.bui
2026-08-14 9:51 ` sashiko-bot [this message]
2026-08-14 11:29 ` Jerome Brunet
2026-08-14 11:28 ` Jerome Brunet
2026-08-14 11:28 ` Jerome Brunet
2026-08-14 11:27 ` [PATCH 1/2] ASoC: meson: aiu: " Jerome Brunet
2026-08-14 11:27 ` Jerome Brunet
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=20260814095120.235F21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=phucduc.bui@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.