Commit daa150ef authored by Clemens Ladisch's avatar Clemens Ladisch Committed by Jaroslav Kysela

[ALSA] usb-audio: properly lock hwptr_done accesses

USB generic driver
Take the substream lock when reading hwptr_done to avoid a race
condition with the updates in the URB callbacks.
Signed-off-by: default avatarClemens Ladisch <clemens@ladisch.de>
parent 9624ea81
...@@ -815,8 +815,14 @@ static int wait_clear_urbs(snd_usb_substream_t *subs) ...@@ -815,8 +815,14 @@ static int wait_clear_urbs(snd_usb_substream_t *subs)
*/ */
static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream) static snd_pcm_uframes_t snd_usb_pcm_pointer(snd_pcm_substream_t *substream)
{ {
snd_usb_substream_t *subs = (snd_usb_substream_t *)substream->runtime->private_data; snd_usb_substream_t *subs;
return subs->hwptr_done; snd_pcm_uframes_t hwptr_done;
subs = (snd_usb_substream_t *)substream->runtime->private_data;
spin_lock(&subs->lock);
hwptr_done = subs->hwptr_done;
spin_unlock(&subs->lock);
return hwptr_done;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment