alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@opensource.wolfsonmicro.com>
To: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Cc: alsa-devel@alsa-project.org, Liam Girdwood <lrg@slimlogic.co.uk>
Subject: Re: [PATCH] ASoC: core: Fix race in dapm_power_widgets
Date: Thu, 4 Nov 2010 14:08:58 -0400	[thread overview]
Message-ID: <20101104180858.GA6088@opensource.wolfsonmicro.com> (raw)
In-Reply-To: <201011041618.07655.peter.ujfalusi@nokia.com>

On Thu, Nov 04, 2010 at 04:18:03PM +0200, Peter Ujfalusi wrote:

> It is really hard to see what is actually happening, but based on my observation 
> the root is this:
> the widget's power_list going to be modified during the dapm_power_widgets call.
> If the previous call to dapm_power_widgets did not finished, and it is going 
> through the widget's power_list, another call to dapm_power_widgets might cause 
> the power_list to be changed. This leads to a crash.
> It is possible that the list which existed in the first dapm_power_widgets call 
> got distroyed by the second call while the first instance was going through 
> that.
> IMHO in most cases the new mutex is not going to add much delay, since it is 
> really rare case, when we can hit this bug.

Sure, it's fairly clear how this could fall over.

> I did not find lower level point where I can safely deal with this problem.

Right, that's what I was thinking - I'm mostly concerned that we need to
have the locking further up the stack rather than further down.  This
feels like a band aid which fixes the symptom (the list pointers getting
corrupted) but it smells like we may have something further up the stack
which can still create issues.  For example, if both DAPM and something
else manipulate the register map simultaneously we could get R/M/W
issues.

  reply	other threads:[~2010-11-04 18:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-04  8:16 [PATCH] ASoC: core: Fix race in dapm_power_widgets Peter Ujfalusi
2010-11-04  9:51 ` Liam Girdwood
2010-11-04 13:43 ` Mark Brown
2010-11-04 14:18   ` Peter Ujfalusi
2010-11-04 18:08     ` Mark Brown [this message]
2010-11-05  7:53       ` Peter Ujfalusi
2010-11-05 14:38         ` Mark Brown
2010-11-06 11:00           ` Liam Girdwood
2010-11-06 15:10             ` 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=20101104180858.GA6088@opensource.wolfsonmicro.com \
    --to=broonie@opensource.wolfsonmicro.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=lrg@slimlogic.co.uk \
    --cc=peter.ujfalusi@nokia.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;
as well as URLs for NNTP newsgroup(s).