* [PATCH] ASoC: qcom: storm: Fix of_node_put leak on error path
@ 2026-10-25 8:16 Tang Bin
2026-10-27 14:07 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: Tang Bin @ 2026-10-25 8:16 UTC (permalink / raw)
To: srini, lgirdwood, broonie, perex, tiwai
Cc: linux-sound, linux-arm-msm, linux-kernel, tangbin
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: qcom: storm: Fix of_node_put leak on error path
2026-10-25 8:16 [PATCH] ASoC: qcom: storm: Fix of_node_put leak on error path Tang Bin
@ 2026-10-27 14:07 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2026-10-27 14:07 UTC (permalink / raw)
To: Tang Bin, srini, lgirdwood, broonie, perex, tiwai
Cc: linux-sound, linux-arm-msm, linux-kernel
On 10/25/26 8:16 AM, Tang Bin wrote:
> 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>
> ---
Reviewed-by: Srinivas Kandagatla<srinivas.kandagatla@oss.qualcomm.com>
--Srini
> 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;
> }
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-27 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 8:16 [PATCH] ASoC: qcom: storm: Fix of_node_put leak on error path Tang Bin
2026-10-27 14:07 ` Srinivas Kandagatla
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®