]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ALSA: usb-audio: Fix races at disconnection
authorTakashi Iwai <tiwai@suse.de>
Fri, 12 Oct 2012 13:12:55 +0000 (15:12 +0200)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 16 Nov 2012 16:46:48 +0000 (16:46 +0000)
commitb40a2450225ea92981da4540f437e34661c6180b
tree5212d1598397a165e8ebe905f10bf6b7f2a8c5f2
parent700949d473671e3b20434d5a4cde71a04db88787
ALSA: usb-audio: Fix races at disconnection

commit 978520b75f0a1ce82b17e1e8186417250de6d545 upstream.

Close some races at disconnection of a USB audio device by adding the
chip->shutdown_mutex and chip->shutdown check at appropriate places.

The spots to put bandaids are:
- PCM prepare, hw_params and hw_free
- where the usb device is accessed for communication or get speed, in
 mixer.c and others; the device speed is now cached in subs->speed
 instead of accessing to chip->dev

The accesses in PCM open and close don't need the mutex protection
because these are already handled in the core PCM disconnection code.

The autosuspend/autoresume codes are still uncovered by this patch
because of possible mutex deadlocks.  They'll be covered by the
upcoming change to rwsem.

Also the mixer codes are untouched, too.  These will be fixed in
another patch, too.

Reported-by: Matthieu CASTET <matthieu.castet@parrot.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
sound/usb/card.h
sound/usb/endpoint.c
sound/usb/mixer.c
sound/usb/pcm.c
sound/usb/proc.c