ALSA: firewire-speakers: fix locking
A message that is not in the archive (sent off-list or not yet received): 20110827164528.1b3a2fc0@stein
A message that is not in the archive (sent off-list or not yet received): 20111001155746.53e902b9@stein
At Sat, 1 Oct 2011 15:57:46 +0200,
Quoted 11 lines · Stefan Richter
Date: Sat, 27 Aug 2011 16:45:28 +0200
There is a lock inversion between
fwspk->mutexandpcm->open_mutexreported by lockdep whenfwspk_hw_freeis called.Fixed by copying the fix from the same former issue in the isight sound driver (commit
f3f7c1837f6bcae3601fc535b339426868bf1549"ALSA: isight: fix locking").Signed-off-by Stefan Richter <[email protected]>
We should put cc to stable kernel, right?
thanks,
Takashi
Quoted 37 lines
--- sound/firewire/speakers.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)Index:
b/sound/firewire/speakers.c
===================================================================sound/firewire/speakers.c +3
-2@@ -772,9 +772,10 @@ static int __devexit fwspk_remove(struct {struct fwspk *fwspk =dev_get_drvdata (dev); -mutex_lock (&fwspk->mutex);amdtp_out_stream_pcm_abort (&fwspk->stream);snd_card_disconnect (fwspk->card); + +mutex_lock (&fwspk->mutex);fwspk_stop_stream (fwspk);mutex_unlock (&fwspk->mutex);@@ -790,8 +791,8 @@ static void fwspk_bus_reset(struct fw_unfcp_bus_reset (fwspk->unit);if (cmp_connection_update (&fwspk->connection) <0 ) { -mutex_lock (&fwspk->mutex);amdtp_out_stream_pcm_abort (&fwspk->stream); +mutex_lock (&fwspk->mutex);fwspk_stop_stream (fwspk);mutex_unlock (&fwspk->mutex);return ;Signature · 4 lines
-- Stefan Richter -=====-==-== =-=- ----= http://arcgraph.de/sr/
A message that is not in the archive (sent off-list or not yet received): 20111003104601.4facd6c7@stein
Quoted 9 lines · Stefan Richter
Quoted 5 lines · On Oct 03 Takashi Iwai wrote:
Quoted 2 lines · Stefan Richter
There is a lock inversion between
fwspk->mutexandpcm->open_mutexreported by lockdep whenfwspk_hw_freeis called.We should put cc to stable kernel, right?
I am not sure. While I could reproduce the lockdep report reliably at device unplugs, I never encountered a deadlock.
The reported scenario requires that the same PCM device is freed twice at the same time, which is prevented by the file reference counting.
Going through the entire dependency chain would require the device being unplugged, being independently close()d, and a ioctl being called with a swapped-out data buffer all happening at the same time.
This doesn't look like an actual problem.
Regards,
Clemens