From: Takashi Iwai Subject: Re: OOPS on USB sound card disconnect while in use Date: Thu, 25 Sep 2008 12:46:27 +0200 Message-ID: References: <48D6C3FE.3000108@trn.iki.fi> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Return-path: Received: from mx1.suse.de (mx1.suse.de [195.135.220.2]) by alsa0.perex.cz (Postfix) with ESMTP id 41FB91037EE for ; Thu, 25 Sep 2008 12:46:28 +0200 (CEST) In-Reply-To: <48D6C3FE.3000108@trn.iki.fi> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: alsa-devel-bounces@alsa-project.org Errors-To: alsa-devel-bounces@alsa-project.org To: Lasse =?ISO-8859-1?Q?K=E4rkk=E4inen?= Cc: alsa-devel@alsa-project.org, linux-usb-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org At Mon, 22 Sep 2008 01:00:30 +0300, Lasse K=E4rkk=E4inen wrote: > = > This has been broken for a long time. > = > Symtoms: programs using the card while it is disconnected get stuck and = > cannot be killed, and OOPS is printed on the log: Does the patch below cure the problem? thanks, Takashi diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index c0c7770..5962e4b 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c @@ -1112,6 +1112,15 @@ void snd_usbmidi_disconnect(struct list_head* p) } if (ep->in) usb_kill_urb(ep->in->urb); + /* free endpoints here; later call can result in Oops */ + if (ep->out) { + snd_usbmidi_out_endpoint_delete(ep->out); + ep->out =3D NULL; + } + if (ep->in) { + snd_usbmidi_in_endpoint_delete(ep->in); + ep->in =3D NULL; + } } del_timer_sync(&umidi->error_timer); }