From: Greg Kroah-Hartman Date: Thu, 18 Oct 2012 19:56:09 +0000 (-0700) Subject: 3.6-stable patches X-Git-Tag: v3.0.47~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7245f107a78f94abed604b977faf634963092346;p=thirdparty%2Fkernel%2Fstable-queue.git 3.6-stable patches added patches: alsa-hda-always-check-array-bounds-in-alc_get_line_out_pfx.patch alsa-hda-fix-registration-race-of-vga-switcheroo.patch alsa-hda-stop-lpib-delay-counting-on-broken-hardware.patch --- diff --git a/queue-3.6/alsa-hda-always-check-array-bounds-in-alc_get_line_out_pfx.patch b/queue-3.6/alsa-hda-always-check-array-bounds-in-alc_get_line_out_pfx.patch new file mode 100644 index 00000000000..1cb51732d6b --- /dev/null +++ b/queue-3.6/alsa-hda-always-check-array-bounds-in-alc_get_line_out_pfx.patch @@ -0,0 +1,35 @@ +From 71aa5ebe36a4e936eff281b375a4707b6a8320f2 Mon Sep 17 00:00:00 2001 +From: David Henningsson +Date: Wed, 17 Oct 2012 12:43:44 +0200 +Subject: ALSA: hda - Always check array bounds in alc_get_line_out_pfx + +From: David Henningsson + +commit 71aa5ebe36a4e936eff281b375a4707b6a8320f2 upstream. + +Even when CONFIG_SND_DEBUG is not enabled, we don't want to +return an arbitrary memory location when the channel count is +larger than we expected. + +Signed-off-by: David Henningsson +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -2629,8 +2629,10 @@ static const char *alc_get_line_out_pfx( + return "PCM"; + break; + } +- if (snd_BUG_ON(ch >= ARRAY_SIZE(channel_name))) ++ if (ch >= ARRAY_SIZE(channel_name)) { ++ snd_BUG(); + return "PCM"; ++ } + + return channel_name[ch]; + } diff --git a/queue-3.6/alsa-hda-fix-registration-race-of-vga-switcheroo.patch b/queue-3.6/alsa-hda-fix-registration-race-of-vga-switcheroo.patch new file mode 100644 index 00000000000..aa732d3453f --- /dev/null +++ b/queue-3.6/alsa-hda-fix-registration-race-of-vga-switcheroo.patch @@ -0,0 +1,105 @@ +From 128960a9ad67e2d119738f5211956e0304517551 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Fri, 12 Oct 2012 17:28:18 +0200 +Subject: ALSA: hda - Fix registration race of VGA switcheroo + +From: Takashi Iwai + +commit 128960a9ad67e2d119738f5211956e0304517551 upstream. + +Delay the registration of VGA switcheroo client to the end of the +probing. Otherwise a too quick switching may result in Oops during +probing. + +Also add the check of the return value from snd_hda_lock_devices(). + +Reported-and-tested-by: Daniel J Blueman +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_intel.c | 31 ++++++++++++++++++++----------- + 1 file changed, 20 insertions(+), 11 deletions(-) + +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -487,6 +487,7 @@ struct azx { + + /* VGA-switcheroo setup */ + unsigned int use_vga_switcheroo:1; ++ unsigned int vga_switcheroo_registered:1; + unsigned int init_failed:1; /* delayed init failed */ + unsigned int disabled:1; /* disabled by VGA-switcher */ + +@@ -2556,7 +2557,9 @@ static void azx_vs_set_state(struct pci_ + if (disabled) { + azx_suspend(&pci->dev); + chip->disabled = true; +- snd_hda_lock_devices(chip->bus); ++ if (snd_hda_lock_devices(chip->bus)) ++ snd_printk(KERN_WARNING SFX ++ "Cannot lock devices!\n"); + } else { + snd_hda_unlock_devices(chip->bus); + chip->disabled = false; +@@ -2599,14 +2602,20 @@ static const struct vga_switcheroo_clien + + static int __devinit register_vga_switcheroo(struct azx *chip) + { ++ int err; ++ + if (!chip->use_vga_switcheroo) + return 0; + /* FIXME: currently only handling DIS controller + * is there any machine with two switchable HDMI audio controllers? + */ +- return vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, ++ err = vga_switcheroo_register_audio_client(chip->pci, &azx_vs_ops, + VGA_SWITCHEROO_DIS, + chip->bus != NULL); ++ if (err < 0) ++ return err; ++ chip->vga_switcheroo_registered = 1; ++ return 0; + } + #else + #define init_vga_switcheroo(chip) /* NOP */ +@@ -2626,7 +2635,8 @@ static int azx_free(struct azx *chip) + if (use_vga_switcheroo(chip)) { + if (chip->disabled && chip->bus) + snd_hda_unlock_devices(chip->bus); +- vga_switcheroo_unregister_client(chip->pci); ++ if (chip->vga_switcheroo_registered) ++ vga_switcheroo_unregister_client(chip->pci); + } + + if (chip->initialized) { +@@ -2974,14 +2984,6 @@ static int __devinit azx_create(struct s + } + + ok: +- err = register_vga_switcheroo(chip); +- if (err < 0) { +- snd_printk(KERN_ERR SFX +- "Error registering VGA-switcheroo client\n"); +- azx_free(chip); +- return err; +- } +- + err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); + if (err < 0) { + snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); +@@ -3208,6 +3210,13 @@ static int __devinit azx_probe(struct pc + + pci_set_drvdata(pci, card); + ++ err = register_vga_switcheroo(chip); ++ if (err < 0) { ++ snd_printk(KERN_ERR SFX ++ "Error registering VGA-switcheroo client\n"); ++ goto out_free; ++ } ++ + dev++; + return 0; + diff --git a/queue-3.6/alsa-hda-stop-lpib-delay-counting-on-broken-hardware.patch b/queue-3.6/alsa-hda-stop-lpib-delay-counting-on-broken-hardware.patch new file mode 100644 index 00000000000..3141ae7cd13 --- /dev/null +++ b/queue-3.6/alsa-hda-stop-lpib-delay-counting-on-broken-hardware.patch @@ -0,0 +1,40 @@ +From 1f04661fde9deda4a2cd5845258715a22d8af197 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 16 Oct 2012 16:52:26 +0200 +Subject: ALSA: hda - Stop LPIB delay counting on broken hardware + +From: Takashi Iwai + +commit 1f04661fde9deda4a2cd5845258715a22d8af197 upstream. + +If LPIB reports a pretty bad value, we can't trust such hardware for +calculating the PCM delay. Automatically turn off the delay counting +when such a problem is encountered. + +Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=48911 + +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/hda_intel.c | 9 ++++++--- + 1 file changed, 6 insertions(+), 3 deletions(-) + +--- a/sound/pci/hda/hda_intel.c ++++ b/sound/pci/hda/hda_intel.c +@@ -2136,9 +2136,12 @@ static unsigned int azx_get_position(str + if (delay < 0) + delay += azx_dev->bufsize; + if (delay >= azx_dev->period_bytes) { +- snd_printdd("delay %d > period_bytes %d\n", +- delay, azx_dev->period_bytes); +- delay = 0; /* something is wrong */ ++ snd_printk(KERN_WARNING SFX ++ "Unstable LPIB (%d >= %d); " ++ "disabling LPIB delay counting\n", ++ delay, azx_dev->period_bytes); ++ delay = 0; ++ chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY; + } + azx_dev->substream->runtime->delay = + bytes_to_frames(azx_dev->substream->runtime, delay); diff --git a/queue-3.6/series b/queue-3.6/series index ab1240da639..ee6ea2f3092 100644 --- a/queue-3.6/series +++ b/queue-3.6/series @@ -65,3 +65,6 @@ mtd-nand-allow-nand_no_subpage_write-to-be-set-from-driver.patch e1000e-change-wthresh-to-1-to-avoid-possible-tx-stalls.patch tpm-propagate-error-from-tpm_transmit-to-fix-a-timeout-hang.patch usb-gadget-at91_udc-fix-dt-support.patch +alsa-hda-fix-registration-race-of-vga-switcheroo.patch +alsa-hda-stop-lpib-delay-counting-on-broken-hardware.patch +alsa-hda-always-check-array-bounds-in-alc_get_line_out_pfx.patch