[alsa-devel] [PATCH] ASoC: core: Fix race in dapm_power_widgets

Mark Brown broonie at opensource.wolfsonmicro.com
Thu Nov 4 14:43:54 CET 2010

On Thu, Nov 04, 2010 at 10:16:45AM +0200, Peter Ujfalusi wrote:

> The exisiting card->mutex can not be used for this purpose,
> since it has been taken in probe time in the
> snd_soc_instantiate_card function. Through probe calls from
> this function eventually dapm_power_widgets will be called,
> which will lead to dead lock.

Hrm.  You're right that the card mutex has issues here but just adding a
lock here leaves us with a race - whenever we make a change to widget
power we're doing a read/modify/write cycle and those aren't locked at
all.  I'm not sure if we need a lower level lock to fix that, or a
higher level lock which would make this one redundant but we ought to
think about it and make sure we've picked the right way.

More information about the Alsa-devel mailing list