aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYong Zhi <yong.zhi@intel.com>2018-08-13 19:15:14 -0400
committerMark Brown <broonie@kernel.org>2018-08-14 11:21:13 -0400
commit12eeeb4f4733bbc4481d01df35933fc15beb8b19 (patch)
tree146bbc33e5d02c825d843917c15fe1d181836122
parentfb504caae7ef85be159743bd4b08ecde269ba55f (diff)
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>
-rw-r--r--sound/soc/intel/skylake/skl.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/sound/soc/intel/skylake/skl.c b/sound/soc/intel/skylake/skl.c
index dce649485649..cf09721ca13e 100644
--- a/sound/soc/intel/skylake/skl.c
+++ b/sound/soc/intel/skylake/skl.c
@@ -838,11 +838,7 @@ static int skl_first_init(struct hdac_bus *bus)
838 838
839 snd_hdac_bus_parse_capabilities(bus); 839 snd_hdac_bus_parse_capabilities(bus);
840 840
841 if (skl_acquire_irq(bus, 0) < 0)
842 return -EBUSY;
843
844 pci_set_master(pci); 841 pci_set_master(pci);
845 synchronize_irq(bus->irq);
846 842
847 gcap = snd_hdac_chip_readw(bus, GCAP); 843 gcap = snd_hdac_chip_readw(bus, GCAP);
848 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap); 844 dev_dbg(bus->dev, "chipset global capabilities = 0x%x\n", gcap);
@@ -875,6 +871,12 @@ static int skl_first_init(struct hdac_bus *bus)
875 if (err < 0) 871 if (err < 0)
876 return err; 872 return err;
877 873
874 err = skl_acquire_irq(bus, 0);
875 if (err < 0)
876 return err;
877
878 synchronize_irq(bus->irq);
879
878 /* initialize chip */ 880 /* initialize chip */
879 skl_init_pci(skl); 881 skl_init_pci(skl);
880 882