USB audio devices & kernel panics
Hello,
I was told to ask at the alsa-dev list as to if there's a known bug and fix with USB audio devices causing kernel panics. A bug was reported on Launchpad stating that it is fully reproducible:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/715318
Cheers
At Fri, 18 Feb 2011 09:35:10 -0500,
Quoted 8 lines · Moustafa Chamli
Hello,
I was told to ask at the alsa-dev list as to if there's a known bug and fix with USB audio devices causing kernel panics. A bug was reported on Launchpad stating that it is fully reproducible:
Could you try the patch below?
thanks,
Takashi
---
sound/usb/card.c +4 -0
@@ -323,6 +323,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,return -ENOMEM ; } +init_mutex (&chip->shutdown_mutex); chip->index = idx; chip->dev = dev; chip->card = card;
@@ -531,6 +532,7 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr) chip = ptr; card = chip->card;mutex_lock (®ister_mutex); +mutex_lock (&chip->shutdown_mutex); chip->shutdown =1 ; chip->num_interfaces--;if (chip->num_interfaces <=0 ) {
@@ -548,9 +550,11 @@ static void snd_usb_audio_disconnect(struct usb_device *dev, void *ptr)snd_usb_mixer_disconnect (p); } usb_chip[chip->index] =NULL ; +mutex_unlock (&chip->shutdown_mutex);mutex_unlock (®ister_mutex);snd_card_free_when_closed (card); }else { +mutex_unlock (&chip->shutdown_mutex);mutex_unlock (®ister_mutex); } }
sound/usb/pcm.c +2 -0
@@ -385,8 +385,10 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream) subs->cur_audiofmt =NULL ; subs->cur_rate =0 ; subs->period_bytes =0 ; +mutex_lock (&subs->stream->chip->shutdown_mutex);if (!subs->stream->chip->shutdown)snd_usb_release_substream_urbs (subs,0 ); +mutex_unlock (&subs->stream->chip->shutdown_mutex);return snd_pcm_lib_free_vmalloc_buffer (substream); }
sound/usb/usbaudio.h +1 -0
@@ -36,6 +36,7 @@ struct snd_usb_audio {struct snd_card *card;u32 usb_id;int shutdown; +struct mutex shutdown_mutex; unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */int num_interfaces;int num_suspended_intf;