Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kuninori.morimoto.gx@renesas.com
Cc: alsa-devel@alsa-project.org
Subject: Re: [bug report] ASoC: snd_soc_component_driver has snd_compr_ops
Date: Tue, 16 Jan 2018 14:14:27 +0300	[thread overview]
Message-ID: <20180116111427.md5obgro7ov2caaf@mwanda> (raw)
In-Reply-To: <20180116111242.GA6302@mwanda>

See also:

sound/soc/soc-compress.c:245 soc_compr_open_fe() warn: 'cstream->runtime->private_data' double freed
sound/soc/soc-compress.c:329 soc_compr_free() warn: 'cstream->runtime->private_data' double freed
sound/soc/soc-compress.c:413 soc_compr_free_fe() warn: 'cstream->runtime->private_data' double freed

regards,
dan carpenter

On Tue, Jan 16, 2018 at 02:12:42PM +0300, Dan Carpenter wrote:
> Hello Kuninori Morimoto,
> 
> The patch 9e7e3738ab0e: "ASoC: snd_soc_component_driver has
> snd_compr_ops" from Oct 11, 2017, leads to the following static
> checker warning:
> 
> 	sound/soc/soc-compress.c:109 soc_compr_open()
> 	warn: 'cstream->runtime->private_data' double freed
> 
> sound/soc/soc-compress.c
>     91          return 0;
>     92  
>     93  machine_err:
>     94          for_each_rtdcom(rtd, rtdcom) {
>     95                  component = rtdcom->component;
>     96  
>     97                  /* ignore duplication for now */
>     98                  if (platform && (component == &platform->component))
>     99                          continue;
>    100  
>    101                  if (!component->driver->compr_ops ||
>    102                      !component->driver->compr_ops->free)
>    103                          continue;
>    104  
>    105                  component->driver->compr_ops->free(cstream);
>                                                     ^^^^^^^^^^^^^^^
> This is in a loop so is the really right?  We end up freeing cstream
> over and over?
> 
>    106          }
>    107  
>    108          if (platform && platform->driver->compr_ops && platform->driver->compr_ops->free)
>    109                  platform->driver->compr_ops->free(cstream);
>                                                     ^^^^^^^^^^^^^
> This second call is what triggers the warning.
> 
>    110  plat_err:
>    111          if (cpu_dai->driver->cops && cpu_dai->driver->cops->shutdown)
>    112                  cpu_dai->driver->cops->shutdown(cstream, cpu_dai);
>    113  out:
>    114          mutex_unlock(&rtd->pcm_mutex);
>    115          return ret;
>    116  }
> 
> regards,
> dan carpenter

  reply	other threads:[~2018-01-16 11:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-16 11:12 [bug report] ASoC: snd_soc_component_driver has snd_compr_ops Dan Carpenter
2018-01-16 11:14 ` Dan Carpenter [this message]
2018-01-17  0:26   ` Kuninori Morimoto

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=20180116111427.md5obgro7ov2caaf@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=kuninori.morimoto.gx@renesas.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