Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Srinivas Kandagatla <srini@kernel.org>
To: Ruoyu Wang <ruoyuw560@gmail.com>,
	Srinivas Kandagatla <srini@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
	Takashi Iwai <tiwai@suse.com>,
	linux-sound@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ASoC: qcom: q6apm: initialize graph refcount before publishing
Date: Thu, 16 Jul 2026 22:19:42 +0100	[thread overview]
Message-ID: <75bb19e8-a96a-4f58-ac5b-3f5556386e3f@kernel.org> (raw)
In-Reply-To: <20260617182150.959983-1-ruoyuw560@gmail.com>



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;


      reply	other threads:[~2026-07-16 21:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 18:21 [PATCH] ASoC: qcom: q6apm: initialize graph refcount before publishing Ruoyu Wang
2026-07-16 21:19 ` Srinivas Kandagatla [this message]

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=75bb19e8-a96a-4f58-ac5b-3f5556386e3f@kernel.org \
    --to=srini@kernel.org \
    --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=ruoyuw560@gmail.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