Skip to content

Commit

Permalink
ALSA: hda - Fix race between PM ops and HDA init/probe
Browse files Browse the repository at this point in the history
PM ops could be triggered before HDA is done initializing
and cause PM to set HDA controller to D3Hot.  This can result
in "CORB reset timeout#2, CORBRP = 65535" and "no codecs
initialized".  Additionally, PM ops can be triggered before
azx_probe_continue finishes (async probe).  This can result
in a NULL deref kernel crash.

To fix this, avoid PM ops if !chip->running.

Signed-off-by: U. Artie Eoff <ullysses.a.eoff@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
U. Artie Eoff authored and Takashi Iwai committed Jul 29, 2015
1 parent 2d1cb7f commit 342e844
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,7 @@ static int azx_suspend(struct device *dev)

chip = card->private_data;
hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
if (chip->disabled || hda->init_failed || !chip->running)
return 0;

bus = azx_bus(chip);
Expand Down Expand Up @@ -902,7 +902,7 @@ static int azx_resume(struct device *dev)

chip = card->private_data;
hda = container_of(chip, struct hda_intel, chip);
if (chip->disabled || hda->init_failed)
if (chip->disabled || hda->init_failed || !chip->running)
return 0;

if (chip->driver_caps & AZX_DCAPS_I915_POWERWELL
Expand Down Expand Up @@ -1027,7 +1027,7 @@ static int azx_runtime_idle(struct device *dev)
return 0;

if (!power_save_controller || !azx_has_pm_runtime(chip) ||
azx_bus(chip)->codec_powered)
azx_bus(chip)->codec_powered || !chip->running)
return -EBUSY;

return 0;
Expand Down

0 comments on commit 342e844

Please sign in to comment.