Skip to content

Commit

Permalink
ASoC: Intel: Skylake: Acquire irq after RIRB allocation
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Pierre-Louis Bossart <[email protected]>
Signed-off-by: Mark Brown <[email protected]>
  • Loading branch information
yongzhi1 authored and broonie committed Aug 14, 2018
1 parent fb504ca commit 12eeeb4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sound/soc/intel/skylake/skl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 12eeeb4

Please sign in to comment.