mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tang Bin <tangbin@cmss.chinamobile.com>
To: srini@kernel.org, lgirdwood@gmail.com, broonie@kernel.org,
	perex@perex.cz, tiwai@suse.com
Cc: linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org, tangbin@cmss.chinamobile.com
Subject: [PATCH] ASoC: qcom: storm: Fix of_node_put leak on error path
Date: Sun, 25 Oct 2026 16:16:09 +0800	[thread overview]
Message-ID: <20261025081610.2675-1-tangbin@cmss.chinamobile.com> (raw)

In storm_parse_of(), if the codec phandle is not found, the function
returns -EINVAL without releasing the CPU phandle that was obtained
earlier via of_parse_phandle(). Since storm_dai_link is a static struct,
the leaked reference persists. On a probe retry, the CPU of_node would
be overwritten by a new of_parse_phandle() call, losing the reference
to the previous one.

Fix this by calling of_node_put(dai_link->cpus->of_node) before
returning -EINVAL when the codec phandle is not found.

Fixes: 79119c798649 ("ASoC: qcom: Add Storm machine driver")
Signed-off-by: Tang Bin <tangbin@cmss.chinamobile.com>
---
 sound/soc/qcom/storm.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sound/soc/qcom/storm.c b/sound/soc/qcom/storm.c
index 6b42fbfd2..6a42876ce 100644
--- a/sound/soc/qcom/storm.c
+++ b/sound/soc/qcom/storm.c
@@ -79,6 +79,7 @@ static int storm_parse_of(struct device *dev)
 	dai_link->codecs->of_node = of_parse_phandle(np, "codec", 0);
 	if (!dai_link->codecs->of_node) {
 		dev_err(dev, "error getting codec phandle\n");
+		of_node_put(dai_link->cpus->of_node);
 		return -EINVAL;
 	}
 
-- 
2.52.0.windows.1




             reply	other threads:[~2026-10-25  8:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25  8:16 Tang Bin [this message]
2026-10-27 14:07 ` Srinivas Kandagatla
2026-11-02  0:24 ` 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=20261025081610.2675-1-tangbin@cmss.chinamobile.com \
    --to=tangbin@cmss.chinamobile.com \
    --cc=broonie@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=srini@kernel.org \
    --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®