From: "Trevor Wu (吳文良)" <Trevor.Wu@mediatek.com>
To: "broonie@kernel.org" <broonie@kernel.org>,
"groeck@chromium.org" <groeck@chromium.org>,
"tiwai@suse.com" <tiwai@suse.com>,
"lgirdwood@gmail.com" <lgirdwood@gmail.com>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"shraash@google.com" <shraash@google.com>,
"perex@perex.cz" <perex@perex.cz>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"lkp@intel.com" <lkp@intel.com>,
"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
"julia.lawall@inria.fr" <julia.lawall@inria.fr>
Subject: Re: [PATCH] ASoC: mediatek: common: Fix refcount leak in parse_dai_link_info
Date: Tue, 11 Apr 2023 03:32:13 +0000 [thread overview]
Message-ID: <948eb609271ed2b735a480266480fd23c148d42f.camel@mediatek.com> (raw)
In-Reply-To: <20230411003431.4048700-1-shraash@google.com>
On Tue, 2023-04-11 at 06:04 +0530, Aashish Sharma wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> Add missing of_node_put()s before the returns to balance
> of_node_get()s and of_node_put()s, which may get unbalanced
> in case the for loop 'for_each_available_child_of_node' returns
> early.
>
> Fixes: 4302187d955f ("ASoC: mediatek: common: add soundcard driver
> common code")
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Julia Lawall <julia.lawall@inria.fr>
> Link: https://lore.kernel.org/r/202304090504.2K8L6soj-lkp@intel.com/
> Signed-off-by: Aashish Sharma <shraash@google.com>
Reviewed-by: Trevor Wu <trevor.wu@mediatek.com>
> ---
> sound/soc/mediatek/common/mtk-soundcard-driver.c | 12 +++++++++---
> 1 file changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/sound/soc/mediatek/common/mtk-soundcard-driver.c
> b/sound/soc/mediatek/common/mtk-soundcard-driver.c
> index 7c55c2cb1f21..738093451ccb 100644
> --- a/sound/soc/mediatek/common/mtk-soundcard-driver.c
> +++ b/sound/soc/mediatek/common/mtk-soundcard-driver.c
> @@ -47,20 +47,26 @@ int parse_dai_link_info(struct snd_soc_card
> *card)
> /* Loop over all the dai link sub nodes */
> for_each_available_child_of_node(dev->of_node, sub_node) {
> if (of_property_read_string(sub_node, "link-name",
> - &dai_link_name))
> + &dai_link_name)) {
> + of_node_put(sub_node);
> return -EINVAL;
> + }
>
> for_each_card_prelinks(card, i, dai_link) {
> if (!strcmp(dai_link_name, dai_link->name))
> break;
> }
>
> - if (i >= card->num_links)
> + if (i >= card->num_links) {
> + of_node_put(sub_node);
> return -EINVAL;
> + }
>
> ret = set_card_codec_info(card, sub_node, dai_link);
> - if (ret < 0)
> + if (ret < 0) {
> + of_node_put(sub_node);
> return ret;
> + }
> }
>
> return 0;
> --
> 2.40.0.577.gac1e443424-goog
>
next prev parent reply other threads:[~2023-04-11 3:32 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-11 0:34 Aashish Sharma
2023-04-11 3:02 ` Guenter Roeck
2023-04-11 3:32 ` Trevor Wu (吳文良) [this message]
2023-04-11 14:19 ` Mark Brown
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=948eb609271ed2b735a480266480fd23c148d42f.camel@mediatek.com \
--to=trevor.wu@mediatek.com \
--cc=alsa-devel@alsa-project.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=groeck@chromium.org \
--cc=julia.lawall@inria.fr \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=lkp@intel.com \
--cc=matthias.bgg@gmail.com \
--cc=perex@perex.cz \
--cc=shraash@google.com \
--cc=tiwai@suse.com \
/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
all inboxes | Powered by JetHome®