Home Home > GIT Browse > stable
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiri Slaby <jslaby@suse.cz>2019-02-12 22:18:26 +0100
committerJiri Slaby <jslaby@suse.cz>2019-02-12 22:21:15 +0100
commit85e1096205e3c7b4545560e28f1dd6ea14f71cc2 (patch)
tree3ff925d9c113a1c58e65b285689781b1fc76cc95
parentd67e799775e13956a1572b34fed5b3d2485b634a (diff)
ALSA: hda - Serialize codec registrations (bnc#1012628).
-rw-r--r--patches.kernel.org/4.20.8-307-ALSA-hda-Serialize-codec-registrations.patch79
-rw-r--r--series.conf1
2 files changed, 80 insertions, 0 deletions
diff --git a/patches.kernel.org/4.20.8-307-ALSA-hda-Serialize-codec-registrations.patch b/patches.kernel.org/4.20.8-307-ALSA-hda-Serialize-codec-registrations.patch
new file mode 100644
index 0000000000..466d30a9f0
--- /dev/null
+++ b/patches.kernel.org/4.20.8-307-ALSA-hda-Serialize-codec-registrations.patch
@@ -0,0 +1,79 @@
+From: Takashi Iwai <tiwai@suse.de>
+Date: Wed, 30 Jan 2019 17:46:03 +0100
+Subject: [PATCH] ALSA: hda - Serialize codec registrations
+References: bnc#1012628
+Patch-mainline: 4.20.8
+Git-commit: 305a0ade180981686eec1f92aa6252a7c6ebb1cf
+
+commit 305a0ade180981686eec1f92aa6252a7c6ebb1cf upstream.
+
+In the current code, the codec registration may happen both at the
+codec bind time and the end of the controller probe time. In a rare
+occasion, they race with each other, leading to Oops due to the still
+uninitialized card device.
+
+This patch introduces a simple flag to prevent the codec registration
+at the codec bind time as long as the controller probe is going on.
+The controller probe invokes snd_card_register() that does the whole
+registration task, and we don't need to register each piece
+beforehand.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Signed-off-by: Jiri Slaby <jslaby@suse.cz>
+---
+ include/sound/hda_codec.h | 1 +
+ sound/pci/hda/hda_bind.c | 3 ++-
+ sound/pci/hda/hda_intel.c | 2 ++
+ 3 files changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/include/sound/hda_codec.h b/include/sound/hda_codec.h
+index 0d98bb9068b1..acacc1900265 100644
+--- a/include/sound/hda_codec.h
++++ b/include/sound/hda_codec.h
+@@ -68,6 +68,7 @@ struct hda_bus {
+ unsigned int response_reset:1; /* controller was reset */
+ unsigned int in_reset:1; /* during reset operation */
+ unsigned int no_response_fallback:1; /* don't fallback at RIRB error */
++ unsigned int bus_probing :1; /* during probing process */
+
+ int primary_dig_out_type; /* primary digital out PCM type */
+ unsigned int mixer_assigned; /* codec addr for mixer name */
+diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c
+index 9174f1b3a987..1ec706ced75c 100644
+--- a/sound/pci/hda/hda_bind.c
++++ b/sound/pci/hda/hda_bind.c
+@@ -115,7 +115,8 @@ static int hda_codec_driver_probe(struct device *dev)
+ err = snd_hda_codec_build_controls(codec);
+ if (err < 0)
+ goto error_module;
+- if (codec->card->registered) {
++ /* only register after the bus probe finished; otherwise it's racy */
++ if (!codec->bus->bus_probing && codec->card->registered) {
+ err = snd_card_register(codec->card);
+ if (err < 0)
+ goto error_module;
+diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
+index 76f03abd15ab..356fda583847 100644
+--- a/sound/pci/hda/hda_intel.c
++++ b/sound/pci/hda/hda_intel.c
+@@ -2228,6 +2228,7 @@ static int azx_probe_continue(struct azx *chip)
+ int dev = chip->dev_index;
+ int err;
+
++ to_hda_bus(bus)->bus_probing = 1;
+ hda->probe_continued = 1;
+
+ /* bind with i915 if needed */
+@@ -2323,6 +2324,7 @@ static int azx_probe_continue(struct azx *chip)
+ if (err < 0)
+ hda->init_failed = 1;
+ complete_all(&hda->probe_wait);
++ to_hda_bus(bus)->bus_probing = 0;
+ return err;
+ }
+
+--
+2.20.1
+
diff --git a/series.conf b/series.conf
index 0fd182aa5c..a6b9d7617f 100644
--- a/series.conf
+++ b/series.conf
@@ -1043,6 +1043,7 @@
patches.kernel.org/4.20.8-304-xfs-eof-trim-writeback-mapping-as-soon-as-it-i.patch
patches.kernel.org/4.20.8-305-ALSA-compress-Fix-stop-handling-on-compressed-.patch
patches.kernel.org/4.20.8-306-ALSA-usb-audio-Add-support-for-new-T-A-USB-DAC.patch
+ patches.kernel.org/4.20.8-307-ALSA-hda-Serialize-codec-registrations.patch
########################################################
# Build fixes that apply to the vanilla kernel too.