* [PATCH] ASoC: qcom: q6apm: initialize graph refcount before publishing
@ 2026-06-17 18:21 Ruoyu Wang
2026-07-16 21:19 ` Srinivas Kandagatla
0 siblings, 1 reply; 2+ messages in thread
From: Ruoyu Wang @ 2026-06-17 18:21 UTC (permalink / raw)
To: Srinivas Kandagatla, Liam Girdwood, Mark Brown, Jaroslav Kysela,
Takashi Iwai, linux-sound, linux-arm-msm, linux-kernel
q6apm_get_audioreach_graph() inserts a newly allocated graph into
graph_idr before initializing its refcount. Another caller looking up the
same graph id can find the graph and call kref_get() before kref_init().
Initialize the refcount before publishing the graph in the IDR.
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
---
sound/soc/qcom/qdsp6/q6apm.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
index 2e5b25b8d00fd..1953e8ca8777b 100644
--- a/sound/soc/qcom/qdsp6/q6apm.c
+++ b/sound/soc/qcom/qdsp6/q6apm.c
@@ -65,6 +65,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui
graph->apm = apm;
graph->info = info;
graph->id = graph_id;
+ kref_init(&graph->refcount);
graph->graph = audioreach_alloc_graph_pkt(apm, info);
if (IS_ERR(graph->graph)) {
@@ -85,8 +86,6 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui
}
mutex_unlock(&apm->lock);
- kref_init(&graph->refcount);
-
q6apm_send_cmd_sync(apm, graph->graph, 0);
return graph;
--
2.51.0
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ASoC: qcom: q6apm: initialize graph refcount before publishing
2026-06-17 18:21 [PATCH] ASoC: qcom: q6apm: initialize graph refcount before publishing Ruoyu Wang
@ 2026-07-16 21:19 ` Srinivas Kandagatla
0 siblings, 0 replies; 2+ messages in thread
From: Srinivas Kandagatla @ 2026-07-16 21:19 UTC (permalink / raw)
To: Ruoyu Wang, Srinivas Kandagatla, Liam Girdwood, Mark Brown,
Jaroslav Kysela, Takashi Iwai, linux-sound, linux-arm-msm,
linux-kernel
On 6/17/26 7:21 PM, Ruoyu Wang wrote:
> q6apm_get_audioreach_graph() inserts a newly allocated graph into
> graph_idr before initializing its refcount. Another caller looking up the
> same graph id can find the graph and call kref_get() before kref_init().
> Initialize the refcount before publishing the graph in the IDR.
>
> Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
> ---
> sound/soc/qcom/qdsp6/q6apm.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sound/soc/qcom/qdsp6/q6apm.c b/sound/soc/qcom/qdsp6/q6apm.c
> index 2e5b25b8d00fd..1953e8ca8777b 100644
> --- a/sound/soc/qcom/qdsp6/q6apm.c
> +++ b/sound/soc/qcom/qdsp6/q6apm.c
> @@ -65,6 +65,7 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui
> graph->apm = apm;
> graph->info = info;
> graph->id = graph_id;
> + kref_init(&graph->refcount);
>
this is going to break the error handing further down the code.
--srini
> graph->graph = audioreach_alloc_graph_pkt(apm, info);
> if (IS_ERR(graph->graph)) {
> @@ -85,8 +86,6 @@ static struct audioreach_graph *q6apm_get_audioreach_graph(struct q6apm *apm, ui
> }
> mutex_unlock(&apm->lock);
>
> - kref_init(&graph->refcount);
> -
> q6apm_send_cmd_sync(apm, graph->graph, 0);
>
> return graph;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-07-16 21:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-17 18:21 [PATCH] ASoC: qcom: q6apm: initialize graph refcount before publishing Ruoyu Wang
2026-07-16 21:19 ` 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®