diff options
author | Takashi Iwai <tiwai@suse.de> | 2019-01-30 19:46:03 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2019-02-01 13:30:09 +0300 |
commit | 305a0ade180981686eec1f92aa6252a7c6ebb1cf (patch) | |
tree | b443210ad45be6c9c0b4f7dfdb52a7593cdf647f /sound/pci/hda/hda_bind.c | |
parent | 35a39f98567d8d3f1cea48f0f30de1a7e736b644 (diff) | |
download | linux-305a0ade180981686eec1f92aa6252a7c6ebb1cf.tar.xz |
ALSA: hda - Serialize codec registrations
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>
Diffstat (limited to 'sound/pci/hda/hda_bind.c')
-rw-r--r-- | sound/pci/hda/hda_bind.c | 3 |
1 files changed, 2 insertions, 1 deletions
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; |