ASoC: meson: aiu: Drop redundant probe error messages
PATCH 1/2 ASoC: meson: aiu: Drop redundant probe error messages
From: bui duc phuc <[email protected]>
The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the dev_err() calls are redundant and can be removed.
--- sound/soc/meson/aiu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/meson/aiu.c +2 -2
@@ -242,12 +242,12 @@ static int aiu_clk_get(struct device *dev) ret =aiu_clk_bulk_get (dev, aiu_i2s_ids,ARRAY_SIZE (aiu_i2s_ids), &aiu->i2s);if (ret) -return dev_err_probe (dev, ret,"Can't get the i2s clocks\n" ); +return ret; ret =aiu_clk_bulk_get (dev, aiu_spdif_ids,ARRAY_SIZE (aiu_spdif_ids), &aiu->spdif);if (ret) -return dev_err_probe (dev, ret,"Can't get the spdif clocks\n" ); +return ret;return ret; }
Signature · 1 line
2.43.0
PATCH 2/2 ASoC: meson: meson-card-utils: Drop redundant probe error messages
From: bui duc phuc <[email protected]>
The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the dev_err() calls are redundant and can be removed.
--- sound/soc/meson/meson-card-utils.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
sound/soc/meson/meson-card-utils.c +2 -6
@@ -290,17 +290,13 @@ int meson_card_probe(struct platform_device *pdev) ret =meson_card_parse_of_optional (&priv->card,"audio-routing" , snd_soc_of_parse_audio_routing); -if (ret) { -dev_err (dev,"error while parsing routing\n" ); +if (ret)return ret; - } 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)
Signature · 1 line
2.43.0
[email protected]
AI reviewRe: [PATCH 2/2] ASoC: meson: meson-card-utils: Drop redundant probe error messages
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
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 <[email protected]>
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.
Quoted 4 lines
sound/soc/meson/meson-card-utils.c +0
-0
[ ... ]
sound/soc/meson/meson-card-utils.c int meson_card_probe(struct platform_device *pdev) · line 296
Quoted 12 lines
sound/soc/meson/meson-card-utils.c +1
-3@@ -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?
Signature · 6 lines
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=2 _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic
Jerome Brunet
maintainerRe: [PATCH 2/2] ASoC: meson: meson-card-utils: Drop redundant probe error messages
Quoted 8 lines · On lun. 14 janv. 2008 at 11:51, [email protected] wrote:
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 themeson_card_reallocate_links()error path. --
Yeah, that was picked up before and it is related to the use of devm_. It is on my TODO list
Signature · 1 line
Jerome
Re: [PATCH 2/2] ASoC: meson: meson-card-utils: Drop redundant probe error messages
Hi Jerome,
Thank you for the review.
Quoted 9 lines
Quoted 5 lines
Pre-existing issues:
- [High] Preexisting dangling pointer dereference (Use-After-Free) and double-free in themeson_card_reallocate_links()error path. --Yeah, that was picked up before and it is related to the use of
devm_. It is on my TODO list
Please take care of that when you have a chance. For now, I’m focusing only on the issues I’ve identified.
Best regards,
Phuc
Re: [PATCH 2/2] ASoC: meson: meson-card-utils: Drop redundant probe error messages
In reply to [email protected]Quoted 7 lines · On lun. 14 janv. 2008 at 11:42, [email protected] wrote:
From: bui duc phuc <[email protected]>
The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the
dev_err()calls are redundant and can be removed.Signed-off-by bui duc phuc <[email protected]>
Quoted 7 lines · On lun. 14 janv. 2008 at 11:42, [email protected] wrote:
From: bui duc phuc <[email protected]>
The functions called here don't log the error themselves, but the error is already reported deeper in the call chain, so the
dev_err()calls are redundant and can be removed.Signed-off-by bui duc phuc <[email protected]>