All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: tiwai@suse.de, Dragos Tarcatu <dragos_tarcatu@mentor.com>,
	alsa-devel@alsa-project.org, broonie@kernel.org,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Subject: Re: [alsa-devel] [PATCH v2 3/3] ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()
Date: 18 Dec 2019 10:57:49 +0900	[thread overview]
Message-ID: <87v9qejsyq.wl-kuninori.morimoto.gx@renesas.com> (raw)
In-Reply-To: <20191218000518.5830-4-pierre-louis.bossart@linux.intel.com>


Hi Pierre-Louis

> From: Dragos Tarcatu <dragos_tarcatu@mentor.com>
> 
> remove_link() is currently calling snd_soc_remove_pcm_runtime() after
> it has already freed the memory for the link name. But this is later
> read from snd_soc_get_pcm_runtime() causing a KASAN use-after-free
> warning. Reorder the cleanups to fix this issue.
> 
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Signed-off-by: Dragos Tarcatu <dragos_tarcatu@mentor.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
>  sound/soc/soc-topology.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
> index f8bd406c6198..2b3c74a0b126 100644
> --- a/sound/soc/soc-topology.c
> +++ b/sound/soc/soc-topology.c
> @@ -548,14 +548,14 @@ static void remove_link(struct snd_soc_component *comp,
>  	if (dobj->ops && dobj->ops->link_unload)
>  		dobj->ops->link_unload(comp, dobj);
>  
> -	kfree(link->name);
> -	kfree(link->stream_name);
> -	kfree(link->cpus->dai_name);
> -
>  	list_del(&dobj->list);
>  
>  	snd_soc_remove_pcm_runtime(comp->card,
>  			snd_soc_get_pcm_runtime(comp->card, link));
> +
> +	kfree(link->name);
> +	kfree(link->stream_name);
> +	kfree(link->cpus->dai_name);
>  	kfree(link);
>  }

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

Thank you for your help !!
Best regards
---
Kuninori Morimoto
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2019-12-18  1:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-18  0:05 [alsa-devel] [PATCH v2 0/3] More stability fixes for corner cases Pierre-Louis Bossart
2019-12-18  0:05 ` [alsa-devel] [PATCH v2 1/3] ASoC: SOF: fix fault at driver unload after failed probe Pierre-Louis Bossart
2019-12-18 20:06   ` [alsa-devel] Applied "ASoC: SOF: fix fault at driver unload after failed probe" to the asoc tree Mark Brown
2019-12-18  0:05 ` [alsa-devel] [PATCH v2 2/3] ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free Pierre-Louis Bossart
2019-12-18 20:06   ` [alsa-devel] Applied "ASoC: SOF: Intel: hda: hda-dai: fix oops on hda_link .hw_free" to the asoc tree Mark Brown
2019-12-18  0:05 ` [alsa-devel] [PATCH v2 3/3] ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime() Pierre-Louis Bossart
2019-12-18  1:57   ` Kuninori Morimoto [this message]
2019-12-18 20:05   ` [alsa-devel] Applied "ASoC: topology: Prevent use-after-free in snd_soc_get_pcm_runtime()" to the asoc tree 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=87v9qejsyq.wl-kuninori.morimoto.gx@renesas.com \
    --to=kuninori.morimoto.gx@renesas.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dragos_tarcatu@mentor.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.com \
    --cc=tiwai@suse.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.