Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754741Ab2KHGsZ (ORCPT ); Thu, 8 Nov 2012 01:48:25 -0500 Received: from cantor2.suse.de ([195.135.220.15]:39674 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751427Ab2KHGsX (ORCPT ); Thu, 8 Nov 2012 01:48:23 -0500 Date: Thu, 08 Nov 2012 07:48:22 +0100 Message-ID: From: Takashi Iwai To: Alan Stern Cc: Christof Meerwald , Daniel Mack , "Artem S. Tashkinov" , Kernel development list , USB list Subject: Re: A reliable kernel panic (3.6.2) and system crash when visiting a particular website In-Reply-To: References: User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL/10.8 Emacs/24.2 (x86_64-suse-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 4046 Lines: 127 At Wed, 7 Nov 2012 15:37:17 -0500 (EST), Alan Stern wrote: > > On Wed, 7 Nov 2012, Takashi Iwai wrote: > > > > What is the right solution for this problem? > > > > How about the patch below? (It's for 3.6, and won't be applied cleanly > > to 3.7, but easy to adapt.) > > I simplified your patch a little. You can't drop the check of stopping endpoint. As Daniel pointed, endpoints might be still running when it's called. I already did a similar failure in the past, so this patch is a revised version with the check for pending operations. > This is for 3.7, not 3.6. I > verified that it does fix the problem raised by the test program. > > If you think this is okay, I'll submit it officially. Don't worry, my patch is also based on 3.7, too :) 3.6 patch was provided just for convenience, testers seemed to have 3.6 systems. thanks, Takashi > > Alan Stern > > > > Index: usb-3.7/sound/usb/endpoint.h > =================================================================== > --- usb-3.7.orig/sound/usb/endpoint.h > +++ usb-3.7/sound/usb/endpoint.h > @@ -19,6 +19,7 @@ int snd_usb_endpoint_set_params(struct s > int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep); > void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, > int force, int can_sleep, int wait); > +void snd_usb_endpoint_sync_stop(struct snd_usb_endpoint *ep); > int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); > int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); > void snd_usb_endpoint_free(struct list_head *head); > Index: usb-3.7/sound/usb/pcm.c > =================================================================== > --- usb-3.7.orig/sound/usb/pcm.c > +++ usb-3.7/sound/usb/pcm.c > @@ -576,6 +576,11 @@ static int snd_usb_pcm_prepare(struct sn > subs->need_setup_ep = false; > } > > + if (subs->sync_endpoint) > + snd_usb_endpoint_sync_stop(subs->sync_endpoint); > + if (subs->data_endpoint) > + snd_usb_endpoint_sync_stop(subs->data_endpoint); > + > /* some unit conversions in runtime */ > subs->data_endpoint->maxframesize = > bytes_to_frames(runtime, subs->data_endpoint->maxpacksize); > Index: usb-3.7/sound/usb/endpoint.c > =================================================================== > --- usb-3.7.orig/sound/usb/endpoint.c > +++ usb-3.7/sound/usb/endpoint.c > @@ -481,7 +481,7 @@ __exit_unlock: > /* > * wait until all urbs are processed. > */ > -static int wait_clear_urbs(struct snd_usb_endpoint *ep) > +void snd_usb_endpoint_sync_stop(struct snd_usb_endpoint *ep) > { > unsigned long end_time = jiffies + msecs_to_jiffies(1000); > unsigned int i; > @@ -502,8 +502,6 @@ static int wait_clear_urbs(struct snd_us > if (alive) > snd_printk(KERN_ERR "timeout: still %d active urbs on EP #%x\n", > alive, ep->ep_num); > - > - return 0; > } > > /* > @@ -556,7 +554,7 @@ static void release_urbs(struct snd_usb_ > > /* stop urbs */ > deactivate_urbs(ep, force, 1); > - wait_clear_urbs(ep); > + snd_usb_endpoint_sync_stop(ep); > > for (i = 0; i < ep->nurbs; i++) > release_urb_ctx(&ep->urb[i]); > @@ -833,7 +831,7 @@ int snd_usb_endpoint_start(struct snd_us > /* just to be sure */ > deactivate_urbs(ep, 0, can_sleep); > if (can_sleep) > - wait_clear_urbs(ep); > + snd_usb_endpoint_sync_stop(ep); > > ep->active_mask = 0; > ep->unlink_mask = 0; > @@ -917,7 +915,7 @@ void snd_usb_endpoint_stop(struct snd_us > ep->prepare_data_urb = NULL; > > if (wait) > - wait_clear_urbs(ep); > + snd_usb_endpoint_sync_stop(ep); > } > } > > @@ -940,7 +938,7 @@ int snd_usb_endpoint_deactivate(struct s > return -EINVAL; > > deactivate_urbs(ep, 1, 1); > - wait_clear_urbs(ep); > + snd_usb_endpoint_sync_stop(ep); > > if (ep->use_count != 0) > return 0; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/