Skip to content

Commit

Permalink
Revert "ALSA: usb-audio: Fix race at stopping the stream"
Browse files Browse the repository at this point in the history
This reverts commit 1620094.

The commit was intended to cover the race condition, but it introduced
yet another regression for devices with the implicit feedback, leading
to a kernel panic due to NULL-dereference in an irq context.

As the race condition that was addressed by the commit is very rare
and the regression is much worse, let's revert the commit for rc1, and
fix the issue properly in a later patch.

Fixes: 1620094 ("ALSA: usb-audio: Fix race at stopping the stream")
Reported-by: Ioan-Adrian Ratiu <adi@adirat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Takashi Iwai authored and Linus Torvalds committed Dec 21, 2016
1 parent ba6d973 commit f8114f8
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions sound/usb/endpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,6 @@ static void snd_complete_urb(struct urb *urb)
if (unlikely(atomic_read(&ep->chip->shutdown)))
goto exit_clear;

if (unlikely(!test_bit(EP_FLAG_RUNNING, &ep->flags)))
goto exit_clear;

if (usb_pipeout(ep->pipe)) {
retire_outbound_urb(ep, ctx);
/* can be stopped during retire callback */
Expand Down Expand Up @@ -537,11 +534,6 @@ static int wait_clear_urbs(struct snd_usb_endpoint *ep)
alive, ep->ep_num);
clear_bit(EP_FLAG_STOPPING, &ep->flags);

ep->data_subs = NULL;
ep->sync_slave = NULL;
ep->retire_data_urb = NULL;
ep->prepare_data_urb = NULL;

return 0;
}

Expand Down Expand Up @@ -1028,6 +1020,10 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep)

if (--ep->use_count == 0) {
deactivate_urbs(ep, false);
ep->data_subs = NULL;
ep->sync_slave = NULL;
ep->retire_data_urb = NULL;
ep->prepare_data_urb = NULL;
set_bit(EP_FLAG_STOPPING, &ep->flags);
}
}
Expand Down

0 comments on commit f8114f8

Please sign in to comment.