mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: Christof Meerwald <cmeerw@cmeerw.org>,
	Daniel Mack <zonque@gmail.com>,
	"Artem S. Tashkinov" <t.artem@lycos.com>,
	Kernel development list <linux-kernel@vger.kernel.org>,
	USB list <linux-usb@vger.kernel.org>
Subject: Re: A reliable kernel panic (3.6.2) and system crash when visiting a particular website
Date: Thu, 08 Nov 2012 07:48:22 +0100	[thread overview]
Message-ID: <s5hvcdgfv49.wl%tiwai@suse.de> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1211071530560.1188-100000@iolanthe.rowland.org>

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;
> 

  reply	other threads:[~2012-11-08  6:48 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20 12:06 Artem S. Tashkinov
2012-10-20 16:27 ` Borislav Petkov
2012-10-20 17:41   ` Artem S. Tashkinov
2012-10-20 18:04     ` Borislav Petkov
2012-10-20 20:57       ` Artem S. Tashkinov
2012-10-20 22:00       ` Artem S. Tashkinov
2012-10-20 20:32     ` Pavel Machek
2012-10-20 22:58       ` Borislav Petkov
2012-10-20 23:15         ` Artem S. Tashkinov
2012-10-21  0:24           ` Borislav Petkov
2012-10-21  1:57             ` Artem S. Tashkinov
2012-10-21 11:08               ` Borislav Petkov
2012-10-21 11:59                 ` Artem S. Tashkinov
2012-10-21 12:03                   ` Daniel Mack
2012-10-21 12:30                     ` Artem S. Tashkinov
2012-10-21 14:21                       ` was: " Daniel Mack
2012-10-21 14:57                         ` Artem S. Tashkinov
2012-10-21 15:22                           ` Daniel Mack
2012-10-21 15:28                             ` Alan Stern
2012-10-21 12:12                   ` Daniel Mack
2012-10-21 15:23                   ` Re: Re: Re: " Alan Stern
2012-10-21 22:20                     ` A strange Linux 3.6 bug: corrupted page table Artem S. Tashkinov
2012-10-21 17:03                   ` Re: Re: Re: Re: A reliable kernel panic (3.6.2) and system crash when visiting a particular website Borislav Petkov
2012-10-21 19:49                     ` Artem S. Tashkinov
2012-10-21 19:54                       ` Daniel Mack
2012-10-21 20:43                         ` Artem S. Tashkinov
2012-10-21 21:00                           ` Daniel Mack
2012-10-21 20:36                       ` Re: Re: Re: Re: " Borislav Petkov
2012-10-22 15:17                       ` Alan Stern
2012-10-22 15:30                         ` Daniel Mack
2012-10-22 15:54                           ` Alan Stern
2012-10-22 17:30                             ` Artem S. Tashkinov
2012-10-22 18:01                               ` Alan Stern
2012-10-21  2:19           ` Alan Stern
2012-10-21 10:34           ` Daniel Mack
2012-10-21 11:59             ` Daniel Mack
2012-11-03 14:10           ` Christof Meerwald
2012-11-03 14:16             ` Daniel Mack
2012-11-03 14:28               ` Sven-Haegar Koch
2012-11-05 19:13               ` Christof Meerwald
2012-11-07 17:34                 ` Alan Stern
2012-11-07 19:19                   ` Takashi Iwai
2012-11-07 20:37                     ` Alan Stern
2012-11-08  6:48                       ` Takashi Iwai [this message]
2012-11-07 20:46                     ` Christof Meerwald
2012-11-07 20:59                     ` Artem S. Tashkinov
2012-11-08  0:42                     ` Daniel Mack
2012-11-08  6:43                       ` Takashi Iwai
2012-11-08  7:31                         ` Daniel Mack
2012-11-08  8:09                           ` Takashi Iwai
2012-11-08 15:55                             ` Alan Stern
2012-11-08 15:58                               ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hvcdgfv49.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=cmeerw@cmeerw.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=stern@rowland.harvard.edu \
    --cc=t.artem@lycos.com \
    --cc=zonque@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome