lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <s5hvcfrxpsc.wl%tiwai@suse.de>
Date:	Thu, 06 Sep 2012 15:08:03 +0200
From:	Takashi Iwai <tiwai@...e.de>
To:	Markus Trippelsdorf <markus@...ppelsdorf.de>
Cc:	Daniel Mack <zonque@...il.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	linux-kernel@...r.kernel.org, alsa-devel@...a-project.org,
	Pierre-Louis Bossart <pierre-louis.bossart@...ux.intel.com>
Subject: Re: snd-usb: "delay: estimated 0, actual 352"

At Thu, 6 Sep 2012 11:43:48 +0200,
Markus Trippelsdorf wrote:
> 
> On 2012.09.06 at 10:21 +0200, Takashi Iwai wrote:
> > At Thu, 06 Sep 2012 09:35:26 +0200,
> > Takashi Iwai wrote:
> > 
> > In short, a patch like below may fix the issue (note: completely
> > untested!)
> 
> No it doesn't, unfortunately...

OK, I start tracking down the problem a bit more deeply now.

The issue happens when the first two URBs are passed to
retire_playback_urb().  These are URBs filled before start_endpoints()
are set, so they contain actually zero size.  Even though these are
a sort of dummy packets, the driver still tries to check with the
queued delay account, and gives bogus errors.

So, essentially the messages are harmless and nothing to worry too
much, but surely it doesn't look sexy.

The patch below should fix the problem.  Please give it a try.


thanks,

Takashi

===

From: Takashi Iwai <tiwai@...e.de>
Subject: [PATCH] ALSA: usb-audio: Fix bogus error messages for delay accounting

The recent fix for the missing fine delayed time adjustment gives
strange error messages at each start of the playback stream, such as
  delay: estimated 0, actual 352
  delay: estimated 353, actual 705

These come from the sanity check in retire_playback_urb().  Before the
stream is activated via start_endpoints(), a few silent packets have
been already sent.  And at this point the delay account is still in
the state as if the new packets are just queued, so the driver gets
confused and spews the bogus error messages.

For fixing the issue, we just need to check whether the received
packet is valid, whether it's zero sized or not.

Reported-by: Markus Trippelsdorf <markus@...ppelsdorf.de>
Cc: <stable@...r.kernel.org> [v3.5+]
Signed-off-by: Takashi Iwai <tiwai@...e.de>
---
 sound/usb/pcm.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index fd5e982..f782ce1 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -1140,6 +1140,12 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
 	int processed = urb->transfer_buffer_length / stride;
 	int est_delay;
 
+	/* ignore the delay accounting when procssed=0 is given, i.e.
+	 * silent payloads are procssed before handling the actual data
+	 */
+	if (!processed)
+		return;
+
 	spin_lock_irqsave(&subs->lock, flags);
 	est_delay = snd_usb_pcm_delay(subs, runtime->rate);
 	/* update delay with exact number of samples played */
-- 
1.7.11.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ