All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alan Stern <stern@rowland.harvard.edu>
To: Christof Meerwald <cmeerw@cmeerw.org>, Takashi Iwai <tiwai@suse.de>
Cc: 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: Wed, 7 Nov 2012 12:34:43 -0500 (EST)	[thread overview]
Message-ID: <Pine.LNX.4.44L0.1211071220230.1175-100000@iolanthe.rowland.org> (raw)
In-Reply-To: <20121105191336.GA1404@edge.cmeerw.net>

On Mon, 5 Nov 2012, Christof Meerwald wrote:

> BTW, I have been able to reproduce the problem on a completely
> different machine (also running Ubuntu 12.10, but different hardware).
> The important thing appears to be that the USB audio device is
> connected via a USB 2.0 hub (and then using the test code posted in
> http://pastebin.com/aHGe1S1X specifying the audio device as
> "plughw:Set" (or whatever it's called) seems to trigger the freeze).

Christof: Thank you for that reference, it was a big help.  After
crashing my system many times I have tracked the problem, at least in
part.  The patch below should prevent your system from freezing.


Takashi: It turns out the the problem is triggered when the audio
subsystem calls snd_usb_endpoint_stop() with wait == 0 and then calls
snd_usb_endpoint_start().  Since the driver doesn't wait for the
outstanding URBs to finish, it tries to submit them again while they
are still active.

Normally the USB core would realize this and fail the submission, but a
bug in ehci-hcd prevented this from happening.  (That bug is what the
patch below fixes.)  The URB gets added to the active list twice,
resulting in list corruption and an oops in interrupt context, which
freezes the system.

The user program that triggers the problem basically looks like this:

  snd_pcm_prepare(rec_pcm);
  snd_pcm_start(rec_pcm);
  snd_pcm_drop(rec_pcm);

  snd_pcm_prepare(rec_pcm);
  snd_pcm_start(rec_pcm);

The snd_pcm_drop call unlinks the URBs but does not wait for them to
finish.  Then the second snd_pcm_start call submits the URBs before
they have finished.

What is the right solution for this problem?

Alan Stern



Index: usb-3.7/drivers/usb/host/ehci-sched.c
===================================================================
--- usb-3.7.orig/drivers/usb/host/ehci-sched.c
+++ usb-3.7/drivers/usb/host/ehci-sched.c
@@ -1632,7 +1632,7 @@ static void itd_link_urb(
 
 	/* don't need that schedule data any more */
 	iso_sched_free (stream, iso_sched);
-	urb->hcpriv = NULL;
+	urb->hcpriv = stream;
 
 	++ehci->isoc_count;
 	enable_periodic(ehci);
@@ -2031,7 +2031,7 @@ static void sitd_link_urb(
 
 	/* don't need that schedule data any more */
 	iso_sched_free (stream, sched);
-	urb->hcpriv = NULL;
+	urb->hcpriv = stream;
 
 	++ehci->isoc_count;
 	enable_periodic(ehci);


  reply	other threads:[~2012-11-07 17:34 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-20 12:06 A reliable kernel panic (3.6.2) and system crash when visiting a particular website 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  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:03                     ` Daniel Mack
2012-10-21 12:30                     ` Artem S. Tashkinov
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 15:28                               ` Alan Stern
2012-10-21 15:36                               ` Daniel Mack
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 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:17                         ` Alan Stern
2012-10-22 15:30                         ` Daniel Mack
2012-10-22 15:54                           ` Alan Stern
2012-10-22 15:54                             ` Alan Stern
2012-10-22 17:30                             ` Artem S. Tashkinov
2012-10-22 18:01                               ` Alan Stern
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 [this message]
2012-11-07 19:19                   ` Takashi Iwai
2012-11-07 20:37                     ` Alan Stern
2012-11-08  6:48                       ` Takashi Iwai
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=Pine.LNX.4.44L0.1211071220230.1175-100000@iolanthe.rowland.org \
    --to=stern@rowland.harvard.edu \
    --cc=cmeerw@cmeerw.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=t.artem@lycos.com \
    --cc=tiwai@suse.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.