ASoC: Intel: Skylake: Acquire irq after RIRB allocation

Cold reboot stress test found that the hda irq could access rirb ring
buffer before its memory gets allocated which resulting in null
pointer dereference inside snd_hdac_bus_update_rirb().

Fix it by moving the skl_acquire_irq after ring buffer allocation.
While here, also change err return from -EBUSY to actual error code.

Signed-off-by: Yong Zhi <yong.zhi@intel.com>
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Yong Zhi 2018-08-13 18:15:14 -05:00 committed by Mark Brown
parent fb504caae7
commit 12eeeb4f47
No known key found for this signature in database
GPG Key ID: 24D68B725D5487D0

View File

@ -838,11 +838,7 @@ static int skl_first_init(struct hdac_bus *bus)
snd_hdac_bus_parse_capabilities(bus);
if (skl_acquire_irq(bus, 0) < 0)
return -EBUSY;
pci_set_master(pci);
synchronize_irq(bus->irq);
gcap = snd_hdac_chip_readw(bus, GCAP);
dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap);
@ -875,6 +871,12 @@ static int skl_first_init(struct hdac_bus *bus)
if (err < 0)
return err;
err = skl_acquire_irq(bus, 0);
if (err < 0)
return err;
synchronize_irq(bus->irq);
/* initialize chip */
skl_init_pci(skl);