mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ASoC: qcom: qdsp6: fix device_node leak when parsing "iommus" phandle
@ 2026-10-25 19:03 Selby Mashiki
  2026-10-27 13:56 ` Srinivas Kandagatla
  0 siblings, 1 reply; 2+ messages in thread
From: Selby Mashiki @ 2026-10-25 19:03 UTC (permalink / raw)
  To: Srinivas Kandagatla, Liam Girdwood, Mark Brown
  Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-arm-msm,
	linux-kernel, Selby Mashiki

q6asm_dai_probe(), q6apm_dai_probe(), and q6usb_component_probe() call
of_parse_phandle_with_fixed_args() to parse the "iommus" property and
extract the stream ID from args.args[0], but never release the reference
acquired on args.np.

Call of_node_put(args.np) after reading args.args[0] in all three probe
functions.

Fixes: 2a9e92d371db ("ASoC: qdsp6: q6asm: Add q6asm dai driver")
Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
Fixes: 72b0b8b29980 ("ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6")
Signed-off-by: Selby Mashiki <mashikiselby@gmail.com>
---
 sound/soc/qcom/qdsp6/q6apm-dai.c | 6 ++++--
 sound/soc/qcom/qdsp6/q6asm-dai.c | 6 ++++--
 sound/soc/qcom/qdsp6/q6usb.c     | 4 +++-
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
index bf1f872a0..49bd0582d 100644
--- a/sound/soc/qcom/qdsp6/q6apm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
@@ -1030,10 +1030,12 @@ static int q6apm_dai_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	rc = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
-	if (rc < 0)
+	if (rc < 0) {
 		pdata->sid = -1;
-	else
+	} else {
 		pdata->sid = args.args[0] & SID_MASK_DEFAULT;
+		of_node_put(args.np);
+	}
 
 	dev_set_drvdata(dev, pdata);
 
diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
index 4f09fdd40..f09856ee4 100644
--- a/sound/soc/qcom/qdsp6/q6asm-dai.c
+++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
@@ -1309,10 +1309,12 @@ static int q6asm_dai_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	rc = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
-	if (rc < 0)
+	if (rc < 0) {
 		pdata->sid = -1;
-	else
+	} else {
 		pdata->sid = args.args[0] & SID_MASK_DEFAULT;
+		of_node_put(args.np);
+	}
 
 	dev_set_drvdata(dev, pdata);
 
diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c
index 6381b289c..5888bc41a 100644
--- a/sound/soc/qcom/qdsp6/q6usb.c
+++ b/sound/soc/qcom/qdsp6/q6usb.c
@@ -382,8 +382,10 @@ static int q6usb_dai_dev_probe(struct platform_device *pdev)
 	}
 
 	ret = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
-	if (!ret)
+	if (!ret) {
 		data->priv.sid = args.args[0] & Q6_USB_SID_MASK;
+		of_node_put(args.np);
+	}
 
 	ret = devm_mutex_init(dev, &data->mutex);
 	if (ret < 0)
-- 
2.56.0


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] ASoC: qcom: qdsp6: fix device_node leak when parsing "iommus" phandle
  2026-10-25 19:03 [PATCH] ASoC: qcom: qdsp6: fix device_node leak when parsing "iommus" phandle Selby Mashiki
@ 2026-10-27 13:56 ` Srinivas Kandagatla
  0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2026-10-27 13:56 UTC (permalink / raw)
  To: Selby Mashiki, Srinivas Kandagatla, Liam Girdwood, Mark Brown
  Cc: Jaroslav Kysela, Takashi Iwai, linux-sound, linux-arm-msm, linux-kernel

On 10/25/26 7:03 PM, Selby Mashiki wrote:
> q6asm_dai_probe(), q6apm_dai_probe(), and q6usb_component_probe() call
> of_parse_phandle_with_fixed_args() to parse the "iommus" property and
> extract the stream ID from args.args[0], but never release the reference
> acquired on args.np.
> 
> Call of_node_put(args.np) after reading args.args[0] in all three probe
> functions.
> 
> Fixes: 2a9e92d371db ("ASoC: qdsp6: q6asm: Add q6asm dai driver")
> Fixes: 9b4fe0f1cd79 ("ASoC: qdsp6: audioreach: add q6apm-dai support")
> Fixes: 72b0b8b29980 ("ASoC: qcom: qdsp6: Add USB backend ASoC driver for Q6")
> Signed-off-by: Selby Mashiki <mashikiselby@gmail.com>
> ---

Thanks for the patch,

LGTM

Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>

--srini
>  sound/soc/qcom/qdsp6/q6apm-dai.c | 6 ++++--
>  sound/soc/qcom/qdsp6/q6asm-dai.c | 6 ++++--
>  sound/soc/qcom/qdsp6/q6usb.c     | 4 +++-
>  3 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/soc/qcom/qdsp6/q6apm-dai.c b/sound/soc/qcom/qdsp6/q6apm-dai.c
> index bf1f872a0..49bd0582d 100644
> --- a/sound/soc/qcom/qdsp6/q6apm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6apm-dai.c
> @@ -1030,10 +1030,12 @@ static int q6apm_dai_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	rc = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
> -	if (rc < 0)
> +	if (rc < 0) {
>  		pdata->sid = -1;
> -	else
> +	} else {
>  		pdata->sid = args.args[0] & SID_MASK_DEFAULT;
> +		of_node_put(args.np);
> +	}
>  
>  	dev_set_drvdata(dev, pdata);
>  
> diff --git a/sound/soc/qcom/qdsp6/q6asm-dai.c b/sound/soc/qcom/qdsp6/q6asm-dai.c
> index 4f09fdd40..f09856ee4 100644
> --- a/sound/soc/qcom/qdsp6/q6asm-dai.c
> +++ b/sound/soc/qcom/qdsp6/q6asm-dai.c
> @@ -1309,10 +1309,12 @@ static int q6asm_dai_probe(struct platform_device *pdev)
>  		return -ENOMEM;
>  
>  	rc = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
> -	if (rc < 0)
> +	if (rc < 0) {
>  		pdata->sid = -1;
> -	else
> +	} else {
>  		pdata->sid = args.args[0] & SID_MASK_DEFAULT;
> +		of_node_put(args.np);
> +	}
>  
>  	dev_set_drvdata(dev, pdata);
>  
> diff --git a/sound/soc/qcom/qdsp6/q6usb.c b/sound/soc/qcom/qdsp6/q6usb.c
> index 6381b289c..5888bc41a 100644
> --- a/sound/soc/qcom/qdsp6/q6usb.c
> +++ b/sound/soc/qcom/qdsp6/q6usb.c
> @@ -382,8 +382,10 @@ static int q6usb_dai_dev_probe(struct platform_device *pdev)
>  	}
>  
>  	ret = of_parse_phandle_with_fixed_args(node, "iommus", 1, 0, &args);
> -	if (!ret)
> +	if (!ret) {
>  		data->priv.sid = args.args[0] & Q6_USB_SID_MASK;
> +		of_node_put(args.np);
> +	}
>  
>  	ret = devm_mutex_init(dev, &data->mutex);
>  	if (ret < 0)


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-27 13:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-25 19:03 [PATCH] ASoC: qcom: qdsp6: fix device_node leak when parsing "iommus" phandle Selby Mashiki
2026-10-27 13:56 ` 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®