Skip to content

Commit

Permalink
ALSA: hda - fix use-after-free after module unload
Browse files Browse the repository at this point in the history
register_vga_switcheroo() sets the PM ops from the hda structure which
is freed later in azx_free. Make sure that these ops are cleared.

Caught by KASAN, initially noticed due to a general protection fault.

Fixes: 246efa4 ("snd/hda: add runtime suspend/resume on optimus support (v4)")
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
Cc: <stable@vger.kernel.org>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
Peter Wu authored and Takashi Iwai committed Jul 11, 2016
1 parent a8ff48c commit ab58d8c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/pci/hda/hda_intel.c
Original file line number Diff line number Diff line change
Expand Up @@ -1218,8 +1218,10 @@ static int azx_free(struct azx *chip)
if (use_vga_switcheroo(hda)) {
if (chip->disabled && hda->probe_continued)
snd_hda_unlock_devices(&chip->bus);
if (hda->vga_switcheroo_registered)
if (hda->vga_switcheroo_registered) {
vga_switcheroo_unregister_client(chip->pci);
vga_switcheroo_fini_domain_pm_ops(chip->card->dev);
}
}

if (bus->chip_init) {
Expand Down

0 comments on commit ab58d8c

Please sign in to comment.