]> git.baikalelectronics.ru Git - kernel.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)
committerTakashi Iwai <tiwai@suse.de>
Tue, 30 Oct 2012 10:06:54 +0000 (11:06 +0100)
commiteb9caba248b0115a7ee8bf46036b99951f70e03f
tree2b0d8619df66706779d9520789e27bf6ca385383
parentf785c5c49353d3db5ecc599feb87daee330ed414
ALSA: usb-audio: Fix races at disconnection

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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/card.h
sound/usb/mixer.c
sound/usb/pcm.c
sound/usb/proc.c
sound/usb/stream.c