ALSA: usxy2: Fix potential doubly allocations
authorTakashi Iwai <tiwai@suse.de>
Mon, 17 May 2021 13:15:41 +0000 (15:15 +0200)
committerTakashi Iwai <tiwai@suse.de>
Mon, 17 May 2021 14:04:55 +0000 (16:04 +0200)
commitc1f24841683f5ce902e49d35ba84abc3e3886427
tree2222963d2a0c485326bdd402f5b5e19b9615a082
parent02d382af1c4e321acbea1c25b97ee13f52b9ac7d
ALSA: usxy2: Fix potential doubly allocations

The PCM shmem pages are allocated in snd_usx2y_usbpcm_prepare().
Theoretically the prepare callback may be called simultaneously for
both playback and capture, hence this allocation can be racy.

Make sure that the allocation is performed exclusively by extending
the pcm_mutex lock to cover the allocation code, too.

Link: https://lore.kernel.org/r/20210517131545.27252-8-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/usb/usx2y/usx2yhwdeppcm.c