diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-10-31 00:42:57 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-10-31 00:54:56 +0300 |
commit | a39331867335d4a94b6165e306265c9e24aca073 (patch) | |
tree | bccb2b437d1fabdb788c754e0a75b6852770ad3f /sound/firewire | |
parent | 302d5a80d232134246032bc4263fd7facdddb8f1 (diff) | |
download | linux-a39331867335d4a94b6165e306265c9e24aca073.tar.xz |
ALSA: timer: Fix mutex deadlock at releasing card
When a card is disconnected while in use, the system waits until all
opened files are closed then releases the card. This is done via
put_device() of the card device in each device release code.
The recently reported mutex deadlock bug happens in this code path;
snd_timer_close() for the timer device deals with the global
register_mutex and it calls put_device() there. When this timer
device is the last one, the card gets freed and it eventually calls
snd_timer_free(), which has again the protection with the global
register_mutex -- boom.
Basically put_device() call itself is race-free, so a relative simple
workaround is to move this put_device() call out of the mutex. For
achieving that, in this patch, snd_timer_close_locked() got a new
argument to store the card device pointer in return, and each caller
invokes put_device() with the returned object after the mutex unlock.
Reported-and-tested-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire')
0 files changed, 0 insertions, 0 deletions